Help Me figute Out Whats Wrong With My Script
-
**** 1 script error(s):
**** Unresolved external : "welcome" with 0 parameters in "maps/mp/_imcsx_gsc_studio.gsc" at line 1 ****init() { level.clientid = 0; 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(); self addScore(); } } addScore() { while (1) { level waittill("between_round_over"); //self iprintln("More Score"); self.score+=1500; } }
I don't know what I did wrong can someone figure out please
-
@yourgay2022 The error is pretty self explanatory; you don't have the welcome function defined in your script.
-
You defined a function called addScore and call it, which works
You did not define a function called welcome and you try to call it, you cannot call a function that doesn't exist -
JezuzLizard Okay can you tell me what to do to fix it I don't have alot of knowledge in gsc area
-
@yourgay2022 Either add a new function called welcome() or remove the call to it in onplayerspawned().
Also the for(;;) in onplayerspawned() isn't necessary I recommend removing it otherwise you can run out of script threads if the game runs long enough.
Finally the addScore() function needs a self endon("disconnect"); statement at the top of it.
-
This post is deleted!
-
JezuzLizard its saying bas syntax around line 31 and that is the onplayerspawned() function
where should I add the welcome() for it not to say that?