SA-MP Forums Archive
checkpoint confusion, please 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)
+--- Thread: checkpoint confusion, please help. (/showthread.php?tid=298295)



checkpoint confusion, please help. - jtweak - 20.11.2011

okay so let me start off by saying, im really new to scripting, i know you guys say to read the wiki, so thats what im doing, now onto my question, im looking at..

public OnPlayerSpawn(playerid)
{
SetPlayerCheckpoint(playerid, 1982.6150, -220.6680, -0.2432, 3.0);
return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
GivePlayerMoney(playerid, 1000);
DisablePlayerCheckpoint(playerid);
return 1;
}




how would i be able to make it so that when a player enters that checkpoint, anotherone shows up for them to go to?


Re: checkpoint confusion, please help. - antonio112 - 20.11.2011

pawn Код:
new pcheck[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
       pcheck[playerid] = 1;
       SetPlayerCheckpoint(playerid, 1982.6150, -220.6680, -0.2432, 3.0);
       return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
       if(pcheck[playerid] == 1)
       {
               GivePlayerMoney(playerid, 1000);
               DisablePlayerCheckpoint(playerid);
               pcheck[playerid] = 2;
               SetPlayerCheckpoint(playerid, X, Y, Z, 3.0);
       }
       else if(pcheck[playerid] == 2)
       {
               GivePlayerMoney(playerid, 2000);
               DisablePlayerCheckpoint(playerid);
               pcheck[playerid] = 3;
               SetPlayerCheckpoint(playerid, X, Y, Z, 3.0);
       }
       // and so on ...
return 1;
}



Re: checkpoint confusion, please help. - jtweak - 20.11.2011

okay thankyou, but whats the new pcheck[MAX_PLAYERS]; for?


Re: checkpoint confusion, please help. - aRoach - 20.11.2011

Check if is the True Checkpoint Number, ... Well if you enter in another Checkpoint it will not give you money and others.. Understand?


Re: checkpoint confusion, please help. - jtweak - 20.11.2011

not at all :/ sorry like i said im new to scripting


Re: checkpoint confusion, please help. - aRoach - 20.11.2011

Quote:
Originally Posted by jtweak
Посмотреть сообщение
not at all :/ sorry like i said im new to scripting
Oh sorry, i've not readed the first post...
Well... When you 'start'( SET ) a new Checkpoint you set the variable too, like the variable is your Checkpoint( It isn't ).. I hope you understand this time...


Re: checkpoint confusion, please help. - antonio112 - 20.11.2011

That pcheck is a variable. It checks if the variable is X when you enter checkpoint to avoid other bugs / complications ... You need to either set a variable and check it, when the player enters in the checkpoint, or check the player position, using IsPlayerInRangeOfPoint ...


Re: checkpoint confusion, please help. - aRoach - 20.11.2011

Quote:
Originally Posted by antonio112
Посмотреть сообщение
That pcheck is a variable. It checks if the variable is X when you enter checkpoint to avoid other bugs / complications ... You need to either set a variable and check it, when the player enters in the checkpoint, or check the player position, using IsPlayerInRangeOfPoint ...
I'm not really good to explain....

But you can use it in another way, it's the same thing...

pawn Код:
pcheck[ playerid ] ++
PS: Not that at the OnPlayerSpawn.


Re: checkpoint confusion, please help. - jtweak - 20.11.2011

Quote:
Originally Posted by antonio112
Посмотреть сообщение
That pcheck is a variable. It checks if the variable is X when you enter checkpoint to avoid other bugs / complications ... You need to either set a variable and check it, when the player enters in the checkpoint, or check the player position, using IsPlayerInRangeOfPoint ...
sorry for bump but that confused me, so theres more code to it other than what you showed me in the first reply?


Re: checkpoint confusion, please help. - aRoach - 20.11.2011

Quote:
Originally Posted by jtweak
Посмотреть сообщение
sorry for bump but that confused me, so theres more code to it other than what you showed me in the first reply?
You have more variants, but i think this is the Fastest !