checkpoint confusion, please help.
#1

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?
Reply
#2

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;
}
Reply
#3

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

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

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

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...
Reply
#7

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 ...
Reply
#8

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.
Reply
#9

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?
Reply
#10

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 !
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)