Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 26

Thread: Unknown command give

  1. #11

    Default Script

    Ok so here is a semi working script and i can show it working live if you like.



    Code:
    main:
    
    if (self.raising == 1)
            end;
    
        if (self == NULL || self == NIL || self.dmteam == "spectator" || self.mef_spectator == 1)
            end;
    
        self.raising = 1;
        
    
    
        //|- CALLED FROM TORSO 
        local.player = parm.other
        
        local.player take "models/weapons/bar.tik" //| Takes the players weapon defined.
    
        wait .3 //| ???
    
        local.player weapon "models/weapons/kar98.tik" //| Gives Weapon & Working  || Give command works on spearhead for me - use "weapon" for Allied Assault
    
        waitframe //| ???
    
        local.player useweaponclass rifle //| Or -  use "models/weapons/kar98.tik" //| Both ways work
    
        self.raising = 0;
    end
    I call this from the mike torso. so it gives the weapon but lets say you start another round on objft when some one joins to start the match sometime the wep wont comback out

  2. #12

    Default

    Quote Originally Posted by Zappa View Post
    I don't understand. Do you mean when local.player is NIL/NULL?

    When that happens you get a message like this: "Script Error: command 'give' applied to NIL/NULL listener"

    But when a command literally does not exist in the game, for example, if you write "giv3" instead of "give",
    you get a message like this:
    "unknown command: giv3"
    and then a "Script file compile error"


    That's why my theory is that he is using a different version without the give command, or maybe the server binaries got corrupted
    i did see the websites 1.12 patch i did install that on the MOHAA side

  3. #13

    Default

    I tested your script, and even though it's not the best script it worked just fine on mohaa 1.11 and 1.0 using the "give" command

    you don't have to use "parm.other" on this script. this is mostly used for triggers/events.
    but somehow this still worked for me, and this may be the reason of the script not working for you on a server with more people

    "self" is the player entity when you execute a script from a state file

    I suggest you to use something like this instead
    and if this script is still giving you the "unknown command give" error, it means that your server binaries are corrupted

    main:
    if (self.raising == 1) {
    end
    }

    if (self == NULL || self == NIL || self.dmteam == "spectator" || self.mef_spectator == 1) {
    end
    }

    self.raising = 1

    // take all weapons except the kar98. Don't use "takeall"
    if (self.dmteam == "allies") {
    self take "models/weapons/colt45.tik"
    self take "models/weapons/m2frag_grenade.tik"
    self take "models/weapons/springfield.tik"
    self take "models/weapons/thompsonsmg.tik"
    self take "models/weapons/bar.tik"
    self take "models/weapons/bazooka.tik"
    self take "models/weapons/shotgun.tik"
    self take "models/items/binoculars.tik"
    self take "models/weapons/m1_garand.tik"
    }
    if (self.dmteam == "axis") {
    self take "models/weapons/p38.tik"
    self take "models/weapons/steilhandgranate.tik"
    self take "models/weapons/kar98sniper.tik"
    self take "models/weapons/mp40.tik"
    self take "models/weapons/mp44.tik"
    self take "models/weapons/panzerschreck.tik"
    self take "models/weapons/shotgun.tik"
    self take "models/items/binoculars.tik"
    }

    self give "models/weapons/kar98.tik"
    self use "models/weapons/kar98.tik"

    self.raising = 0
    end

  4. #14

    Default

    I Like what you did here, but im slotting the weapons in an row slow fashsion see my example.


    Slot 1 = kar98
    slot 2 = enfield
    slot 3 = Springfield
    slot 4 = Kar98Sniper
    slot 5 = Fg42

    have a look at the mike_torso bellow to see my states example.

    //|==========================|
    //|-------RAISE_WEAPON-------|
    //|==========================|

    state RAISE_WEAPON
    {
    movetype legs

    entrycommands
    {
    viewmodelanim pullout

    // just to make sure nothing funky's
    // attached that shouldn't be.
    correctweaponattachments
    }

    states
    {
    //CHANGE SOLT 1 TO KAR98

    RAISE_THE_KAR98_ENFIELD : IS_NEW_WEAPON "mainhand" "lee here"
    RAISE_THE_KAR98_MOSIN : IS_NEW_WEAPON "mainhand" "mosin here"
    RAISE_THE_KAR98_M1 : IS_NEW_WEAPON "mainhand" "m1 here"




    RAISE_PISTOL : IS_NEW_WEAPONCLASS "mainhand" "pistol"
    RAISE_RIFLE : IS_NEW_WEAPONCLASS "mainhand" "rifle"
    RAISE_GRENADE : IS_NEW_WEAPONCLASS "mainhand" "grenade"
    RAISE_SMG : IS_NEW_WEAPONCLASS "mainhand" "smg"
    RAISE_MG : IS_NEW_WEAPONCLASS "mainhand" "mg"
    // RAISE_PISTOL : IS_NEW_WEAPONCLASS "mainhand" "item" // hold all items like a pistol for now
    RAISE_HEAVY : IS_NEW_WEAPONCLASS "mainhand" "heavy"
    RAISE_PAPERS : IS_NEW_WEAPON "mainhand" "Papers"


    // RAISE_RIFLE : default
    RAISE_NOANIM : default
    }
    }

    state RAISE_NOANIM
    {
    entrycommands
    {
    // delay the activation for a frame so that the player
    // spends at least one frame without a weapon, thus
    // letting the legs state know that we've switched
    commanddelay 0.05 activatenewweapon
    commanddelay 0.05 forcetorsostate "STAND_REAL"
    }


    //|===============================|
    //|-------ENFIELD TO KAR98--------|
    //|===============================|

    state RAISE_THE_KAR98_ENFIELD
    {
    movetype legs

    entrycommands

    {
    exec global/WeapScr/enfield.scr
    }
    states
    {
    STAND : !NEW_WEAPON
    }
    }

    AS Mentioned the rifle only stops coming out when lets say im in the game waiting on a player to join in a round of FTOBJ that moment were it respawns teams it hides the weapon becuase the code is not rechecking for a gun becuase you empty as the rifle is taken from you hard to explain lol but im tryin
    Last edited by assasin5469; October 31st, 2022 at 11:45 PM.

  5. #15

    Default

    Quote Originally Posted by Zappa View Post
    I tested your script, and even though it's not the best script it worked just fine on mohaa 1.11 and 1.0 using the "give" command

    you don't have to use "parm.other" on this script. this is mostly used for triggers/events.
    but somehow this still worked for me, and this may be the reason of the script not working for you on a server with more people

    "self" is the player entity when you execute a script from a state file

    I suggest you to use something like this instead
    and if this script is still giving you the "unknown command give" error, it means that your server binaries are corrupted

    main:
    if (self.raising == 1) {
    end
    }

    if (self == NULL || self == NIL || self.dmteam == "spectator" || self.mef_spectator == 1) {
    end
    }

    self.raising = 1

    // take all weapons except the kar98. Don't use "takeall"
    if (self.dmteam == "allies") {
    self take "models/weapons/colt45.tik"
    self take "models/weapons/m2frag_grenade.tik"
    self take "models/weapons/springfield.tik"
    self take "models/weapons/thompsonsmg.tik"
    self take "models/weapons/bar.tik"
    self take "models/weapons/bazooka.tik"
    self take "models/weapons/shotgun.tik"
    self take "models/items/binoculars.tik"
    self take "models/weapons/m1_garand.tik"
    }
    if (self.dmteam == "axis") {
    self take "models/weapons/p38.tik"
    self take "models/weapons/steilhandgranate.tik"
    self take "models/weapons/kar98sniper.tik"
    self take "models/weapons/mp40.tik"
    self take "models/weapons/mp44.tik"
    self take "models/weapons/panzerschreck.tik"
    self take "models/weapons/shotgun.tik"
    self take "models/items/binoculars.tik"
    }

    self give "models/weapons/kar98.tik"
    self use "models/weapons/kar98.tik"

    self.raising = 0
    end



    So, after some testing of this script, you so kindly made I noticed that it would just always drop the weapon on raise. I also noticed in the
    mike_torso see here

    // delay the activation for a frame so that the player
    // spends at least one frame without a weapon, thus
    // letting the legs state know that we've switched
    commanddelay 0.05 activatenewweapon
    commanddelay 0.05 forcetorsostate "STAND_REAL"


    you need to have a wait in the frame so it can execute the animation properly. In this script you made we have the three spots that would require a "waitframe" so I've added them in the fixed code below


    main:
    if (self.raising == 1) {
    end
    }

    if (self == NULL || self == NIL || self.dmteam == "spectator" || self.mef_spectator == 1) {
    end
    }

    self.raising = 1; //|ADDED ";" TO THE END NOT SURE IF IT MATTERS

    if (self.dmteam == "allies")
    waitframe
    {
    self take models/weapons/colt45.tik
    self take models/weapons/m2frag_grenade.tik
    self take models/weapons/springfield.tik
    self take models/weapons/thompsonsmg.tik
    self take models/weapons/bar.tik
    self take models/weapons/bazooka.tik
    self take models/weapons/shotgun.tik
    self take models/items/binoculars.tik
    self take models/weapons/m1_garand.tik
    }

    if (self.dmteam == "axis")
    waitframe
    {
    self take models/weapons/p38.tik
    self take models/weapons/steilhandgranate.tik
    self take models/weapons/kar98sniper.tik
    self take models/weapons/mp40.tik
    self take models/weapons/mp44.tik
    self take models/weapons/panzerschreck.tik
    self take models/weapons/shotgun.tik
    self take models/items/binoculars.tik
    }
    waitframe
    self give models/weapons/kar98.tik
    self useweaponclass rifle
    self.raising = 0; //|ADDED ";" TO THE END NOT SURE IF IT MATTERS
    end



    give it a try let me know if it fires good for you both in freezetag-obj and on new joining player team refresh

    update:
    im building a way to slot each one in order the at moment, so progress is coming along !
    Last edited by assasin5469; November 1st, 2022 at 06:45 AM.

  6. #16

    Default

    Quote Originally Posted by Zappa View Post
    but somehow this still worked for me, and this may be the reason of the script not working for you on a server with more people
    Probably because parm.other was populated on spawn event when you joined the local server, and it's a global variable that doesn't get cleared, just overwritten. Like you say, with multiple players spawning or trigger threads starting, it could be anyone at that point in time.

    Quote Originally Posted by assasin5469 View Post
    you need to have a wait in the frame so it can execute the animation properly. In this script you made we have the three spots that would require a "waitframe" so I've added them in the fixed code below
    I wouldn't put them before the braces of each if, because that will prevent the code block under it from being conditional.

    It would be like doing:


    if (self.dmteam == "allies") waitframe

    self take models/weapons/colt45.tik
    self take models/weapons/m2frag_grenade.tik
    self take models/weapons/springfield.tik
    self take models/weapons/thompsonsmg.tik
    self take models/weapons/bar.tik
    self take models/weapons/bazooka.tik
    self take models/weapons/shotgun.tik
    self take models/items/binoculars.tik
    self take models/weapons/m1_garand.tik


    Without braces, the first instruction after the if statement will be executed. Since you have an instruction (waitframe) before the first brace, it will perform the wait and the braces are functionally ignored.

    The reason it works is because all the take commands are running, which is fine, and arguably more sensible (if I understand the requirements right).

    So you could just do:


    main:

    if (!self || self.dmteam == "spectator" || self.mef_spectator == 1) { //self will never be NIL in any situation, it's a redundant check. It may be the case self will never be NULL in THIS situation, but you can keep it for sanity. !self is shorthand as NULL (and NILL, empty string, or 0) will evaluate to false.
    end
    }

    if (self.raising == 1) { //put this after the first if statement because if self ever is NULL, then this will error when checking the raising property of a NULL object
    end
    }

    self.raising = 1 //semicolon is not needed, only if you have several instructions on one line (e.g. "self.raising; waitframe")

    waitframe

    self take models/weapons/colt45.tik
    self take models/weapons/m2frag_grenade.tik
    self take models/weapons/springfield.tik
    self take models/weapons/thompsonsmg.tik
    self take models/weapons/bar.tik
    self take models/weapons/bazooka.tik
    self take models/weapons/shotgun.tik
    self take models/weapons/m1_garand.tik
    self take models/weapons/p38.tik
    self take models/weapons/steilhandgranate.tik
    self take models/weapons/kar98sniper.tik
    self take models/weapons/mp40.tik
    self take models/weapons/mp44.tik
    self take models/weapons/panzerschreck.tik
    self take models/weapons/shotgun.tik
    self take models/items/binoculars.tik

    waitframe

    self give models/weapons/kar98.tik
    self useweaponclass rifle

    self.raising = 0
    end


    As you're introducing waits inside a script with moving (and sometimes disappearing) parts (i.e. players), then it may be prudent to add extra checks after them, as it's not impossible they could have disconnected or changed team within those few frames, even if it's very unlikely.
    Last edited by 1337Smithy; November 1st, 2022 at 03:31 PM.

  7. #17

    Default

    Quote Originally Posted by 1337Smithy View Post
    Probably because parm.other was populated on spawn event when you joined the local server, and it's a global variable that doesn't get cleared, just overwritten. Like you say, with multiple players spawning or trigger threads starting, it could be anyone at that point in time.



    I wouldn't put them before the braces of each if, because that will prevent the code block under it from being conditional.

    It would be like doing:


    if (self.dmteam == "allies") waitframe

    self take models/weapons/colt45.tik
    self take models/weapons/m2frag_grenade.tik
    self take models/weapons/springfield.tik
    self take models/weapons/thompsonsmg.tik
    self take models/weapons/bar.tik
    self take models/weapons/bazooka.tik
    self take models/weapons/shotgun.tik
    self take models/items/binoculars.tik
    self take models/weapons/m1_garand.tik


    Without braces, the first instruction after the if statement will be executed. Since you have an instruction (waitframe) before the first brace, it will perform the wait and the braces are functionally ignored.

    The reason it works is because all the take commands are running, which is fine, and arguably more sensible (if I understand the requirements right).

    So you could just do:


    main:

    if (!self || self.dmteam == "spectator" || self.mef_spectator == 1) { //self will never be NIL in any situation, it's a redundant check. It may be the case self will never be NULL in THIS situation, but you can keep it for sanity. !self is shorthand as NULL (and NILL, empty string, or 0) will evaluate to false.
    end
    }

    if (self.raising == 1) { //put this after the first if statement because if self ever is NULL, then this will error when checking the raising property of a NULL object
    end
    }

    self.raising = 1 //semicolon is not needed, only if you have several instructions on one line (e.g. "self.raising; waitframe")

    waitframe

    self take models/weapons/colt45.tik
    self take models/weapons/m2frag_grenade.tik
    self take models/weapons/springfield.tik
    self take models/weapons/thompsonsmg.tik
    self take models/weapons/bar.tik
    self take models/weapons/bazooka.tik
    self take models/weapons/shotgun.tik
    self take models/weapons/m1_garand.tik
    self take models/weapons/p38.tik
    self take models/weapons/steilhandgranate.tik
    self take models/weapons/kar98sniper.tik
    self take models/weapons/mp40.tik
    self take models/weapons/mp44.tik
    self take models/weapons/panzerschreck.tik
    self take models/weapons/shotgun.tik
    self take models/items/binoculars.tik

    waitframe

    self give models/weapons/kar98.tik
    self useweaponclass rifle

    self.raising = 0
    end


    As you're introducing waits inside a script with moving (and sometimes disappearing) parts (i.e. players), then it may be prudent to add extra checks after them, as it's not impossible they could have disconnected or changed team within those few frames, even if it's very unlikely.

    Very good point here, would this be able to be individual put to each weapon group or model player?
    HTML Code:
    SLOT 1: if allied selects weapon slot 1 it would be either "M1 Garand" "Lee Enfield" or the "Mosin" - they get the kar. - Same for axis
    SLOT 2: If allied player selects weapon slot 2 it would be either the "Springfield" or the "SVT rifle" - they get the Mosin. - Same for axis
    SLOT 3: If allied player selects weapon slot 2 it would be either the "Thompson smg" or the "ppsh smg" "Sten Mark II" - they get the Enfield. - Same for axis 
    etc...

    currently the way im setting it up is bugged out so im still working a layout out would this be possible with what you have dome above to take and make individual .scr for each weapon as its on file?

  8. #18

    Default

    ok so right now it's working with no drops or dead raises but here's the thing I'm running in to a glitch with the code. let me see if I can explain.

    I currently have the Springfield changed to the Mosin. and moved the Springfield down to the BAR slot

    The Springfield is change to the Mosin - It works but here's the glitch, when selecting the BARit is set to give you the Springfield but, on the Springfield, it supposed to be the Mosin so the code can't figure out which to pull out, so it gives me the Mosin on the BAR because this is first in slot for raising.




    BAR CODE

    main:

    if (!self || self.dmteam == "spectator" || self.mef_spectator == 1) { //self will never be NIL in any situation, it's a redundant check. It may be the case self will never be NULL in THIS situation, but you can keep it for sanity. !self is shorthand as NULL (and NILL, empty string, or 0) will evaluate to false.
    end
    }

    if (self.raising == 1) { //put this after the first if statement because if self ever is NULL, then this will error when checking the raising property of a NULL object
    end
    }

    self.raising = 1 //semicolon is not needed, only if you have several instructions on one line (e.g. "self.raising; waitframe")

    waitframe

    //|RIFLES
    self take models/weapons/m1_garand.tik
    self take models/weapons/enfield.tik
    self take models/weapons/Mosin_Nagant_Rifle.tik

    //|SNIPERS
    self take models/weapons/svt_rifle.tik
    //self take models/weapons/springfield.tik //| we want to keep this weapon

    //|SMG
    self take models/weapons/thompsonsmg.tik
    self take models/weapons/ppsh_smg.tik

    //|HEAVEY WEAPONS
    self take models/weapons/bar.tik
    self take models/weapons/bazooka.tik
    self take models/weapons/shotgun.tik

    //|PISOlS
    self take models/weapons/colt45.tik
    self take models/weapons/p38.tik
    self take models/weapons/Webley_Revolver.tik

    //|GRENADES
    self take models/weapons/mills_grenade.tik
    self take models/weapons/m2frag_grenade.tik
    self take models/weapons/RDG-1_Smoke_grenade.tik

    waitframe

    self give models/weapons/springfield.tik
    self give models/weapons/M18_smoke_grenade.tik
    self useweaponclass rifle

    self.raising = 0
    end





    SPRINGFIELD CODE



    main:

    if (!self || self.dmteam == "spectator" || self.mef_spectator == 1) { //self will never be NIL in any situation, it's a redundant check. It may be the case self will never be NULL in THIS situation, but you can keep it for sanity. !self is shorthand as NULL (and NILL, empty string, or 0) will evaluate to false.
    end
    }

    if (self.raising == 1) { //put this after the first if statement because if self ever is NULL, then this will error when checking the raising property of a NULL object
    end
    }

    self.raising = 1 //semicolon is not needed, only if you have several instructions on one line (e.g. "self.raising; waitframe")

    waitframe

    //|RIFLES
    self take models/weapons/m1_garand.tik
    self take models/weapons/enfield.tik
    //self take models/weapons/Mosin_Nagant_Rifle.tik //| we want to keep this weapon

    //|SNIPERS
    self take models/weapons/svt_rifle.tik
    self take models/weapons/springfield.tik

    //|SMG
    self take models/weapons/thompsonsmg.tik
    self take models/weapons/ppsh_smg.tik

    //|HEAVEY WEAPONS
    self take models/weapons/bar.tik
    self take models/weapons/bazooka.tik
    self take models/weapons/shotgun.tik

    //|PISOlS
    self take models/weapons/colt45.tik
    self take models/weapons/p38.tik
    self take models/weapons/Webley_Revolver.tik

    //|GRENADES
    self take models/weapons/mills_grenade.tik
    self take models/weapons/m2frag_grenade.tik
    self take models/weapons/RDG-1_Smoke_grenade.tik

    waitframe

    self give models/weapons/Mosin_Nagant_Rifle.tik
    self give models/weapons/M18_smoke_grenade.tik
    self useweaponclass rifle

    self.raising = 0
    end




    both of these have their own individual .scr file its working great aside from this last little detail any thoughts on a way around this?

  9. #19

    Default

    Ok so I've sat and tried to learn this coding better I can't for the life of me get this one to fire off what i want it to do. Maybe some fresh eyes will see my error




    main:

    thread spring

    end


    spring:

    local.n = randomint 99999

    self weaponcommand mainhand targetname ("w" + local.n)


    if ($("w" + local.n)){

    local.weap = $("w" + local.n)

    local.weap.targetname = ""
    }


    else if (!self || self.dmteam == "spectator" || self.mef_spectator == 1) {
    end
    }


    if (self.raising == 1) {
    end
    }

    self.raising = 1




    switch ( local.weapon ) {





    case "models/weapons/bazooka.tik":
    case "models/weapons/colt45.tik":
    case "models/weapons/m2frag_grenade.tik":
    case "models/items/binoculars.tik":
    case "models/weapons/RDG-1_Smoke_grenade.tik":

    self take "models/weapons/bazooka.tik"
    self take "models/weapons/colt45.tik"
    self take "models/weapons/m2frag_grenade.tik"
    self take "models/items/binoculars.tik"
    self take "models/weapons/RDG-1_Smoke_grenade.tik"

    switch (self.model) {

    case "models/player/allied_oss.tik":
    case "models/player/allied_sas.tik":
    case "models/player/allied_manon.tik":
    case "models/player/american_army.tik":
    case "models/player/american_ranger.tik":
    case "models/player/allied_airborne.tik":
    case "models/player/allied_101st_Scout.tik":
    case "models/player/allied_101st_Captain.tik":
    case "models/player/allied_russian_seaman.tik":
    case "models/player/allied_101st_Infantry.tik":
    case "models/player/allied_501st_PIR_Scout.tik":
    case "models/player/allied_russian_corporal.tik":
    case "models/player/allied_501st_PIR_Soldier.tik":
    case "models/player/allied_russian_seaman_fps.tik":
    case "models/player/allied_russian_crazy_boris.tik":
    case "models/player/allied_russian_recon_scout.tik":
    case "models/player/allied_british_tank_corporal.tik":
    case "models/player/allied_russian_recon_soldier.tik":
    case "models/player/allied_british_6th_airborne_captain.tik":
    case "models/player/allied_british_6th_airborne_paratrooper.tik":

    self give "models/weapons/springfield.tik"
    waitframe
    self useweaponclass rifle

    default:

    self give "models/weapons/springfield.tik"
    waitframe
    self useweaponclass rifle

    self.raising = 0
    end
    }
    }

    Last edited by assasin5469; November 3rd, 2022 at 11:20 AM.

  10. #20

    Default

    I am not sure if having a switch inside a switch like that is even valid.
    Have you tried if the sitch works if they are seperate on their own ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •