Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help improper syntax but i dont know where
#1
i have attempted to make a mod and its suposed to be a random weapon generator so every time you die you get a random weapon.... but when i launch it i get an improper syntax but im not sure where it is. heres the code if anyone knows let me know because i understand coding to a point and i want to know if i misses something or mesed up typing or its in the wrong spot:

Code:
onPlayerSpawned()
{
     self endon("disconnect");
     self endon("death");
     self Takeallweapons();

     for(;;)
     {
         self waittill("spawned_player");
giveRandomWeapon()
{
     weaponList = [];
     weaponList[weaponList.size] = "ak47_mp";
     weaponList[weaponList.size] = "ak74u_mp";
     weaponList[weaponList.size] = "mp5k_mp";
     weaponList[weaponList.size] = "commando_mp";
     weaponList[weaponList.size] = "l96a1_mp";
     weaponList[weaponList.size] = "dragunov_mp";
     weaponList[weaponList.size] = "wa2000_mp";
     weaponList[weaponList.size] = "m1911dw_mp";
     weaponList[weaponList.size] = "skorpion_mp";
     weaponList[weaponList.size] = "mac11_mp";
     weaponList[weaponList.size] = "uzi_mp";
     weaponList[weaponList.size] = "pm63_mp";
     weaponList[weaponList.size] = "mpl_mp";
     weaponList[weaponList.size] = "spectre_mp";
     weaponList[weaponList.size] = "kiparis_mp";
     weaponList[weaponList.size] = "m16_mp";
     weaponList[weaponList.size] = "enfield_mp";
     weaponList[weaponList.size] = "m14_mp";
     weaponList[weaponList.size] = "famas_mp";
     weaponList[weaponList.size] = "galil_mp";
     weaponList[weaponList.size] = "aug_mp";
     weaponList[weaponList.size] = "fnfal_mp";
     weaponList[weaponList.size] = "g11_mp";
     weaponList[weaponList.size] = "hs10_mp";
     weaponList[weaponList.size] = "rottweil72_mp";
     weaponList[weaponList.size] = "ithaca_mp";
     weaponList[weaponList.size] = "spas_mp";
     weaponList[weaponList.size] = "hk21_mp";
     weaponList[weaponList.size] = "rpk_mp";
     weaponList[weaponList.size] = "m60_mp"
     weaponList[weaponList.size] = "stoner63_mp";
     weaponList[weaponList.size] = "psg1_mp";
     weaponList[weaponList.size] = "aspdw_mp";
     weaponList[weaponList.size] = "cz75dw_mp";
     weaponList[weaponList.size] = "makarovdw_mp";
     weaponList[weaponList.size] = "pythondw_mp";
     weaponList[weaponList.size] = "knife_ballistic_mp";
     weaponList[weaponList.size] = "crossbow_explosive_mp";
     weaponList[weaponList.size] = "minigun_mp";
    


     weapon = weaponList[randomInt( weaponList.size )];
     self giveWeapon( weapon );
     self setSpawnWeapon( weapon );
     self setPerk("specialty_fastreload");
}
}
}

also do i need more files to make it work? (the current file i am having trouble with is _rank.gsc) if i need anything more or anything less or fixed please tell me i am willing to learn.
Reply

#2
Code:
onPlayerSpawned()
{
     self endon("disconnect");
     self endon("death");
     for(;;)
     {
        self waittill("spawned_player");
        self takeallweapons();
        wait 0.1;
        self thread GiveRandomWeapon();
    }
}

giveRandomWeapon()
{
     weaponList = [];
     weaponList[weaponList.size] = "ak47_mp";
     weaponList[weaponList.size] = "ak74u_mp";
     weaponList[weaponList.size] = "mp5k_mp";
     weaponList[weaponList.size] = "commando_mp";
     weaponList[weaponList.size] = "l96a1_mp";
     weaponList[weaponList.size] = "dragunov_mp";
     weaponList[weaponList.size] = "wa2000_mp";
     weaponList[weaponList.size] = "m1911dw_mp";
     weaponList[weaponList.size] = "skorpion_mp";
     weaponList[weaponList.size] = "mac11_mp";
     weaponList[weaponList.size] = "uzi_mp";
     weaponList[weaponList.size] = "pm63_mp";
     weaponList[weaponList.size] = "mpl_mp";
     weaponList[weaponList.size] = "spectre_mp";
     weaponList[weaponList.size] = "kiparis_mp";
     weaponList[weaponList.size] = "m16_mp";
     weaponList[weaponList.size] = "enfield_mp";
     weaponList[weaponList.size] = "m14_mp";
     weaponList[weaponList.size] = "famas_mp";
     weaponList[weaponList.size] = "galil_mp";
     weaponList[weaponList.size] = "aug_mp";
     weaponList[weaponList.size] = "fnfal_mp";
     weaponList[weaponList.size] = "g11_mp";
     weaponList[weaponList.size] = "hs10_mp";
     weaponList[weaponList.size] = "rottweil72_mp";
     weaponList[weaponList.size] = "ithaca_mp";
     weaponList[weaponList.size] = "spas_mp";
     weaponList[weaponList.size] = "hk21_mp";
     weaponList[weaponList.size] = "rpk_mp";
     weaponList[weaponList.size] = "m60_mp"
     weaponList[weaponList.size] = "stoner63_mp";
     weaponList[weaponList.size] = "psg1_mp";
     weaponList[weaponList.size] = "aspdw_mp";
     weaponList[weaponList.size] = "cz75dw_mp";
     weaponList[weaponList.size] = "makarovdw_mp";
     weaponList[weaponList.size] = "pythondw_mp";
     weaponList[weaponList.size] = "knife_ballistic_mp";
     weaponList[weaponList.size] = "crossbow_explosive_mp";
     weaponList[weaponList.size] = "minigun_mp";
    


     weapon = weaponList[randomInt( weaponList.size )];
     self giveWeapon( weapon );
     self setSpawnWeapon( weapon );
     self setPerk("specialty_fastreload");
}
You created a function that's not supposed to be there. In GSC you have to "call" the function name.
You create giveRandomWeapon() but you didn't use it properly.


What you can also do is disable some stuff in _class.gsc so you wouldn't need the takeallweapons code or disable killstreaks and such. It's not much of a difference as either one works. If you also need a code to make you automatically select a class do something like...

Code:
onPlayerConnect()
{
    self endon("disconnect");
    for(;;)
    {
        level waittill( "connected", player);
        player thread onPlayerSpawned();
        player thread SetTeam();
    }
}

SetTeam()
{
    self notify("menuresponse", game["menu_team"], "autoassign");
    wait 0.01;
    self notify("menuresponse", "changeclass", "class1");
    wait 0.01;
    return;
}
This will make you automatically spawn when a player connects using the auto-assign functions that's in the game.
Do not take life too seriously. You will never get out of it alive.
[Image: UGPjFJa.jpg]
Reply

#3
(07-28-2013, 00:59)DidUknowiPwn Wrote:
Code:
onPlayerSpawned()
{
     self endon("disconnect");
     self endon("death");
     for(;;)
     {
        self waittill("spawned_player");
        self takeallweapons();
        wait 0.1;
        self thread GiveRandomWeapon();
    }
}

giveRandomWeapon()
{
     weaponList = [];
     weaponList[weaponList.size] = "ak47_mp";
     weaponList[weaponList.size] = "ak74u_mp";
     weaponList[weaponList.size] = "mp5k_mp";
     weaponList[weaponList.size] = "commando_mp";
     weaponList[weaponList.size] = "l96a1_mp";
     weaponList[weaponList.size] = "dragunov_mp";
     weaponList[weaponList.size] = "wa2000_mp";
     weaponList[weaponList.size] = "m1911dw_mp";
     weaponList[weaponList.size] = "skorpion_mp";
     weaponList[weaponList.size] = "mac11_mp";
     weaponList[weaponList.size] = "uzi_mp";
     weaponList[weaponList.size] = "pm63_mp";
     weaponList[weaponList.size] = "mpl_mp";
     weaponList[weaponList.size] = "spectre_mp";
     weaponList[weaponList.size] = "kiparis_mp";
     weaponList[weaponList.size] = "m16_mp";
     weaponList[weaponList.size] = "enfield_mp";
     weaponList[weaponList.size] = "m14_mp";
     weaponList[weaponList.size] = "famas_mp";
     weaponList[weaponList.size] = "galil_mp";
     weaponList[weaponList.size] = "aug_mp";
     weaponList[weaponList.size] = "fnfal_mp";
     weaponList[weaponList.size] = "g11_mp";
     weaponList[weaponList.size] = "hs10_mp";
     weaponList[weaponList.size] = "rottweil72_mp";
     weaponList[weaponList.size] = "ithaca_mp";
     weaponList[weaponList.size] = "spas_mp";
     weaponList[weaponList.size] = "hk21_mp";
     weaponList[weaponList.size] = "rpk_mp";
     weaponList[weaponList.size] = "m60_mp"
     weaponList[weaponList.size] = "stoner63_mp";
     weaponList[weaponList.size] = "psg1_mp";
     weaponList[weaponList.size] = "aspdw_mp";
     weaponList[weaponList.size] = "cz75dw_mp";
     weaponList[weaponList.size] = "makarovdw_mp";
     weaponList[weaponList.size] = "pythondw_mp";
     weaponList[weaponList.size] = "knife_ballistic_mp";
     weaponList[weaponList.size] = "crossbow_explosive_mp";
     weaponList[weaponList.size] = "minigun_mp";
    


     weapon = weaponList[randomInt( weaponList.size )];
     self giveWeapon( weapon );
     self setSpawnWeapon( weapon );
     self setPerk("specialty_fastreload");
}
You created a function that's not supposed to be there. In GSC you have to "call" the function name.
You create giveRandomWeapon() but you didn't use it properly.

ok how do i fix it?
Reply

#4
I gave you the proper code for it, just copy and replace it.
Do not take life too seriously. You will never get out of it alive.
[Image: UGPjFJa.jpg]
Reply

#5
(07-28-2013, 01:06)DidUknowiPwn Wrote: I gave you the proper code for it, just copy and replace it.

ok i went to run the mod and go on combat training nuketown and it does the same thing "improper syntax" :/ is there something im missing?
Reply

#6
You tell me, run in developer 2 and developer_script 1 (type these in your Black Ops console) and run the match again..
Do not take life too seriously. You will never get out of it alive.
[Image: UGPjFJa.jpg]
Reply

#7
(07-28-2013, 01:24)DidUknowiPwn Wrote: You tell me, run in developer 2 and developer_script 1 (type these in your Black Ops console) and run the match again..

okay thanks but now its says improper syntax at _rank.gsc(47):
weaponList[weaponList.size] = "stoner63_mp";

i know what it means but i spelled it right and im pretty sure its the right dvar or what ever they call it... would there be any way to fix it or just remove that line of code?

(07-28-2013, 19:25)Brandeeno Wrote:
(07-28-2013, 01:24)DidUknowiPwn Wrote: You tell me, run in developer 2 and developer_script 1 (type these in your Black Ops console) and run the match again..

okay thanks but now its says improper syntax at _rank.gsc(47):
weaponList[weaponList.size] = "stoner63_mp";

i know what it means but i spelled it right and im pretty sure its the right dvar or what ever they call it... would there be any way to fix it or just remove that line of code?
k never mind i cant just removed the stoner63 dvar code and its now saying:

improper syntax at _rank.gsc(47):
weaponList[weaponList.size] = "mpl_mp";
im thinking either i have the wrong weapons dvar codes or the line code: weaponList[weaponList.size] = "nameofweapon_mp";
is incorrect or i just to remove the ";" at the end of each : weaponList[weaponList.size] = "nameofweapon";
until i reach the last one

if i remove the line of codes for the weapons each time it will go down the list and eventually all the wepons on the list will be gone ... i have seen this kind of behaviour

is there anything i can do? help please
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  why permissions dont work. ? ExoGamer* 4 3,257 07-21-2013, 13:46
Last Post: X-Track
  Dont Read Stocker 1 2,396 02-24-2013, 19:38
Last Post: JariZ
  liberation dont work? puistis 7 7,773 02-18-2013, 09:17
Last Post: JariZ
  Weapon dont work?? Erik The Born 3 2,838 02-05-2013, 19:53
Last Post: Yamato
  [TUTORIAL] Basic Syntax KrypTiK 0 2,007 12-29-2012, 20:33
Last Post: KrypTiK
  Syntax error :( denn4550 6 4,228 11-09-2012, 04:13
Last Post: DEUS
  Help why dont this work pap12322221112 9 4,958 10-21-2012, 16:04
Last Post: DEUS
Sad WHY DOES MW3 DONT HAS NOCLIP! can1907 7 5,206 07-23-2012, 19:38
Last Post: JariZ
  [News] DONT UPDATE SERVERS YET Cyanide 10 6,970 06-22-2012, 13:17
Last Post: hillbilly
  I buy mw3 and multiplayer dont work Bloodfocus 5 3,066 06-15-2012, 11:16
Last Post: d0h!

Forum Jump:


Users browsing this thread:
2 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.