SA-MP Forums Archive
Sending these lines only once. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Sending these lines only once. (/showthread.php?tid=371485)



Sending these lines only once. - ValentinLaw - 23.08.2012

I've got on OnPlayerSpawn the following code:

PHP код:
             TogglePlayerSpectating(playerid0);
             
TogglePlayerControllableplayerid);
             
SetTimer("start"5000false);
             
GameTextForAll("~g~~h~Are you ready?",4000,3);
              
pInfo[playerid][pAlive] = true;
            
round[playerid]=1
But everyime a player joins it shows the script I wrote to everyone who logs-in.
I want it, when the gamemode starts it shows it to all the player connected at THAT time, who connects later doesn't see this. :>


Re: Sending these lines only once. - HuSs3n - 23.08.2012

pawn Код:
//On Top
new show;

//ongamemodeinit
public OnGameModeInit()
{
     show=1;
     SetTimer("StopShowing",10*1000,false);
     return 1;
}
 
//
forward StopShowing();
public StopShowing()
{
  show=0;
  return 1;
}


public OnPlayerSpawn(playerid)
{
        if(show == 1)
       {
             TogglePlayerSpectating(playerid, 0);
             TogglePlayerControllable( playerid, 0 );
             SetTimer("start", 5000, false); // you sure about this?
             GameTextForAll("~g~~h~Are you ready?",4000,3); //Why for all ?
             pInfo[playerid][pAlive] = true;
             round[playerid]=1;  
       }
       return 1;
}



Re: Sending these lines only once. - scottyishere - 23.08.2012

pawn Код:
TogglePlayerSpectating(playerid, 0);
TogglePlayerControllable( playerid, 0 );
SetTimerEx("start", 5000, false,"i",playerid);
GameTextForPlayerl(playerid,"~g~~h~Are you ready?",4000,3);
pInfo[playerid][pAlive] = true;
round[playerid]=1;
and your "start" function should look like this:
pawn Код:
forward start(playerid);
public start(playerid)
{
     //your code here
}