[Support] [GSC] Jug / Weapon script
-
#include maps\mp\_utility; #include common_scripts\utility; #include maps\mp\zombies\_zm; #include maps\mp\zombies\_zm_utility; init() { for(;;) { level thread onPlayerConnect(); player thread onPlayerSpawned(); } } onPlayerConnect() { for(;;) { level waittill("connected", player); player thread onPlayerSpawned(); } } onPlayerSpawned() { level endon("game_ended"); self endon("disconnect"); for(;;) { self waittill("spawned_player"); player thread welcome(); level.perk_purchase_limit = 9; } } welcome() { self endon("disconnect"); self waittill("spawned_player"); self maps/mp/zombies/_zm_perks::give_perk( "specialty_armorvest" ); self giveWeapon( "ak74u_upgraded_zm" ); wait 7; self iprintln("^2" +self.name + "^7 , your perk limit has been removed"); }
Well if anyone wants to try to help off this feel free.
-
KillaG4 Don't set perk limit on spawn, set that on init.
Also you are threading onplayerspawn multiple times. -
Yea Dont know what i had onplayerspawn multiple times this was the correct way i had it before I believe
#include maps\mp\_utility; #include common_scripts\utility; #include maps\mp\zombies\_zm; #include maps\mp\zombies\_zm_utility; init() { for(;;) { level thread onPlayerConnect(); level.perk_purchase_limit = 9; } } onPlayerConnect() { for(;;) { level waittill("connected", player); player thread onPlayerSpawned(); } } onPlayerSpawned() { level endon("game_ended"); self endon("disconnect"); for(;;) { self waittill("spawned_player"); player thread welcome(); } } welcome() { self endon("disconnect"); self waittill("spawned_player"); self maps/mp/zombies/_zm_perks::give_perk( "specialty_armorvest" ); self giveWeapon( "ak74u_upgraded_zm" ); wait 7; self iprintln("^2" +self.name + "^7 , your perk limit has been removed"); }
-
Now the server is crashing over and over again on startup
-
This isnt crashing now but nothing happens when the game starts
#include maps\mp\_utility; #include common_scripts\utility; #include maps\mp\zombies\_zm; #include maps\mp\zombies\_zm_utility; init() { level thread onPlayerConnect(); level.perk_purchase_limit = 9; } onPlayerConnect() { for(;;) { level waittill("connected", player); player thread onPlayerSpawned(); } } onPlayerSpawned() { self endon("disconnect"); level endon("game_ended"); for(;;) { player thread welcome(); } } welcome() { self endon("disconnect"); self waittill("spawned_player"); self maps/mp/zombies/_zm_perks::give_perk( "specialty_armorvest" ); self giveWeapon( "ak74u_upgraded_zm" ); wait 7; self iprintln("^2" +self.name + "^7 , your perk limit has been removed"); }
-
KillaG4 is it because you removed
self waittill("spawned_player");
from the player spawn loop? I'd say try that and see if that makes a difference. -
homura said in Jug / Weapon script:
#include maps\mp\_utility; #include common_scripts\utility; #include maps\mp\zombies\_zm; #include maps\mp\zombies\_zm_utility; init() { level.clientid = 0; level.perk_purchase_limit = 9; level thread onplayerconnect(); player thread onplayerspawned(); } onplayerconnect() { for ( ;; ) { level waittill( "connecting", player ); player.clientid = level.clientid; level.clientid++; player thread onplayerspawned(); } } onplayerspawned() { level endon( "game_ended" ); self endon( "disconnect" ); for(;;) { self waittill( "spawned_player" ); self IPrintLnBold( "^5whatever welcome message you want here" ); self welcome(); } } welcome() { self waittill( "spawned_player" ); self maps/mp/zombies/_zm_perks::give_perk( "specialty_armorvest" ); self giveWeapon( "mp5k_upgraded_zm" ); wait 7; self iprintln("^2" +self.name + "^7 , your perk limit has been removed"); }
It all works with this now, only issue now is the first person who joins the game doesnt get the gun. So once others start to join they all get the item and if the first player kills themselves then then get it
-
KillaG4 Generally you don't want to run the onplayerspawn thread twice like you are doing here in init and on connect.
-
hmm I keep ending up adding it back I believe it causes issues if i dont keep it in both spots. Ill play around with it again tomorrow.
-
Anyone know how to make it so the first person who joins the server gets the welcome function?? Works for anyone else who joins just not the first person.
-
#include maps\mp\_utility; #include common_scripts\utility; #include maps\mp\zombies\_zm; #include maps\mp\zombies\_zm_utility; init() { level.clientid = 0; level.perk_purchase_limit = 9; level thread onplayerconnect(); } onplayerconnect() { for ( ;; ) { level waittill( "connecting", player ); player.clientid = level.clientid; player thread onplayerspawned(); level.clientid++; } } onplayerspawned() { level endon( "game_ended" ); self endon( "disconnect" ); for(;;) { self welcome(); } } welcome() { self IPrintLnBold( "^Killa Server" ); self waittill( "spawned_player" ); self maps/mp/zombies/_zm_perks::give_perk( "specialty_armorvest" ); self giveWeapon( "mp5k_upgraded_zm" ); wait 7; self iprintln("^2" +self.name + "^7 , your perk limit has been removed"); }
Ok i fixed it, I was calling
self waittill( "spawned_player" );
twice which was my issue. So if anyone is interested this will give Jug and a weapon and set perk limit to 9 -
So after using it for a day I find if 2 players join while the game is going and then round ends and they join in it only gives 1 player the items and jug and just ignores the second player who also joined with them.