How to set up a checkpoint? - 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: How to set up a checkpoint? (
/showthread.php?tid=497304)
How to set up a checkpoint? -
799023555 - 26.02.2014
How to set up a checkpoint to trigger an event?
For example, players came to a red circle, the server will give him some money
Sorry for my bad English.
Re: How to set up a checkpoint? -
Knekt - 26.02.2014
Код:
OnPlayerEnterCheckpoint(playerid, checkpointid)
?
Re: How to set up a checkpoint? -
799023555 - 26.02.2014
Yes!Thank you!
Quote:
Originally Posted by Knekt
Код:
OnPlayerEnterCheckpoint(playerid, checkpointid)
?
|
Re: How to set up a checkpoint? -
Mriss - 26.02.2014
pawn Код:
OnPlayerEnterCheckpoint(playerid, checkpointid)
{
GivePlayerMoney(playerid, AMOUNT OF MONEY HERE!);
return 1;
}
pawn Код:
OnGameModeInit
}
SetPlayerCheckpoint(playerid, Float:x, Float:y, Float:z, Float:size);
return 1;
}
Re: How to set up a checkpoint? -
799023555 - 26.02.2014
Thank you!
Can you add a timer? Players must wait for 20 seconds at a checkpoint in order to get money.
Quote:
Originally Posted by Knekt
Код:
OnPlayerEnterCheckpoint(playerid, checkpointid)
?
|
Quote:
Originally Posted by Mriss
pawn Код:
OnPlayerEnterCheckpoint(playerid, checkpointid) { GivePlayerMoney(playerid, AMOUNT OF MONEY HERE!); return 1; }
pawn Код:
OnGameModeInit } SetPlayerCheckpoint(playerid, Float:x, Float:y, Float:z, Float:size); return 1; }
|
Re: How to set up a checkpoint? -
xKolle - 26.02.2014
First add this:
Код:
OnGameModeInit
{
new checkpoint[MAX_PLAYERS];
new Timer;
SetPlayerCheckpoint(playerid, Float:x, Float:y, Float:z, Float:size);
return 1;
}
timer is new timer variable which will determine how much time we need to wait in checkpoint.
checkpoint will determine max cps we can use.
next
Код:
public OnPlayerEnterCheckpoint(playerid) // If the player enters a particluar checkpoint
{
Timer = SetTimerEx("GiveStats", 20000, false, "i", playerid);
checkpoint[playerid] = 1;
return 1;
}
if you want player to fail if he leaves checkpoint, then add this:
Код:
public OnPlayerLeaveCheckpoint(playerid)
{
if(checkpoint[playerid] == 1)
{
KillTimer(Timer);
checkpoint[playerid] = 0;
}
return 1;
}
so, if player succeds:
Код:
forward GiveStats(playerid);
public GiveStats(playerid)
{
SetPlayerScore(playerid,GetPlayerScore(playerid)+10 ); //"10" is number of score player will receive, feel free to change it
GivePlayerMoney(playerid,9999); //"9999" is money player will receive
SendClientMessage(playerid, 0x0000FF ,"You've capture the zone and received 9999 $ and10 score");
Hope I helped you.