SA-MP Forums Archive
Help? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help? (/showthread.php?tid=195657)



Help? - SkizzoTrick - 03.12.2010

pawn Код:
forward SetNewSpawn(playerid);
public SetNewSpawn(playerid)
{
        PlayerInfo[playerid][pFirstTime] = 1;
        SetPlayerPos(playerid,1669.9395,1495.3009,10.7783);
        SetPlayerInterior(playerid,0);
        KillTimer(SpawningTimer);
        return 1;
}

forward SetPlayerSpawn(playerid);
public SetPlayerSpawn(playerid)
{
    if(PlayerInfo[playerid][pFirstTime] == 1)
        {
            if(gPlayerLogged[playerid] == 1)
                {
                SetPlayerPos(playerid, PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z] + 1);
                return 1;
                }
        }
    if(PlayerInfo[playerid][pFirstTime] == 0)
        {
            if(gPlayerLogged[playerid] == 1)
                {
                SetPlayerPos(playerid,1.808619,32.384357,1199.593750);
                SetPlayerInterior(playerid,1);
                SpawningTimer = SetTimer("SetNewSpawn",15000,true);
                GameTextForPlayer(playerid,"~r~Hello to San Andreas Pilot Life~n~~b~",5000,5);
                SendClientMessage(playerid,COLOR_PINK,"*Pilot is taking his headphones and start talking");
                SendClientMessage(playerid,COLOR_YELLOW,"This is the Shamal Pilot,we will land in 15 seconds!");
                return 1;
                }
        }

    return 1;
}


public OnPlayerSpawn(playerid)
{
    SetPlayerSpawn(playerid);
    return 1;
}
When you spawn,it repeats spawning you with this:
pawn Код:
if(PlayerInfo[playerid][pFirstTime] == 0)
        {
            if(gPlayerLogged[playerid] == 1)
                {
                SetPlayerPos(playerid,1.808619,32.384357,1199.593750);
                SetPlayerInterior(playerid,1);
                SpawningTimer = SetTimer("SetNewSpawn",15000,true);
                GameTextForPlayer(playerid,"~r~Hello to San Andreas Pilot Life~n~~b~",5000,5);
                SendClientMessage(playerid,COLOR_PINK,"*Pilot is taking his headphones and start talking");
                SendClientMessage(playerid,COLOR_YELLOW,"This is the Shamal Pilot,we will land in 15 seconds!");
                return 1;
                }
Even if my account says that FirstTime is 1


Re: Help? - SpartanLegends - 05.12.2010

In that situation, where the player is new and it is going to do those messages and create a spawn for them, your timer does not carry over the player's ID so any attempt to use it would not work.

The suggested solution which I hope works is below.

Change this:

pawn Код:
SpawningTimer = SetTimer("SetNewSpawn",15000,true);
Into this:

pawn Код:
SpawningTimer = SetTimerEx("SetNewSpawn",15000,true,"d",playerid);