Checkpoints - 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: Checkpoints (
/showthread.php?tid=255600)
Checkpoints -
sim_sima - 16.05.2011
Checkpoints is a rellative new thing to me. I dont get it.
It seems like i cant make multiple checkpoints, i can only make one checkpoint and one function for the checkpoint in "OnPlayerEnterCheckpoint". I want to make like the checkpoint has an ID and make "if(checkpointid == blabla)" etc. Just like pickups.
Re: Checkpoints -
sim_sima - 16.05.2011
Come on people! Someone may know
Re: Checkpoints -
sim_sima - 16.05.2011
Omg...
Re: Checkpoints -
Cjgogo - 16.05.2011
downlaod Incognito's checkpoint streamer there you'll find anythign you want:
https://sampforum.blast.hk/showthread.php?tid=102865
Re: Checkpoints -
sim_sima - 16.05.2011
Quote:
Originally Posted by Cjgogo
|
Thanks.
Re: Checkpoints -
sim_sima - 16.05.2011
Well. Is a streamer really requiered?
Im makeing a RPG gamemode, and i have a command called "/job <jobname>".
When the player types ex. "/job mechanic", a checkpoint appears for him, and when he enteres it his skin changes to job skin etc. Cant be true that i need a streamer, or?
AW: Checkpoints -
Nero_3D - 16.05.2011
At first lets define some checkpoints
pawn Код:
enum {
CP_SPAWN,
CP_COMMAND
}
Than we create our own SetPlayerCheckpoint function with ids
pawn Код:
stock SetPlayerCheckpointEx(playerid, checkpointid, Float: x, Float: y, Float: z, Float: size)
{
if(SetPlayerCheckpoint(playerid, x, y, z, size)) {
SetPVarInt(playerid, "checkpointid", checkpointid);
return true;
}
return false;
}
stock DisablePlayerCheckpointEx(playerid)
{
if(GetPVarInt(playerid, "checkpointid") && DisablePlayerCheckpoint(playerid)) {
DeletePVar(playerid, "checkpointid");
return true;
}
return false;
}
// \/ Tells the compiler that DisablePlayerCheckpoint will be replaced with DisablePlayerCheckpointEx
#define DisablePlayerCheckpoint DisablePlayerCheckpointEx
pawn Код:
//OnPlayerSpawn as example
SetPlayerCheckpointEx(playerid, CP_SPAWN, 0.0, 0.0, 0.0, 5.0);
//in some command
SetPlayerCheckpointEx(playerid, CP_COMMAND, 0.0, 0.0, 0.0, 5.0);
And now at the end we can check what checkpoint the player is in
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
switch(GetPVarInt(playerid, "checkpointid")) {
case CP_SPAWN: {
}
case CP_COMMAND: {
}
}
return true;
}
A streamer does actually the same it just saves the checkpoint data and shows always the nearest
Re: AW: Checkpoints -
sim_sima - 16.05.2011
Quote:
Originally Posted by Nero_3D
At first lets define some checkpoints
pawn Код:
enum { CP_SPAWN, CP_COMMAND }
Than we create our own SetPlayerCheckpoint function with ids
pawn Код:
stock SetPlayerCheckpointEx(playerid, checkpointid, Float: x, Float: y, Float: z, Float: size) { if(SetPlayerCheckpoint(playerid, x, y, z, size)) { SetPVarInt(playerid, "checkpointid", checkpointid); return true; } return false; } stock DisablePlayerCheckpointEx(playerid) { if(GetPVarInt(playerid, "checkpointid") && DisablePlayerCheckpoint(playerid)) { DeletePVar(playerid, "checkpointid"); return true; } return false; } // \/ Tells the compiler that DisablePlayerCheckpoint will be replaced with DisablePlayerCheckpointEx #define DisablePlayerCheckpoint DisablePlayerCheckpointEx
pawn Код:
//OnPlayerSpawn as example SetPlayerCheckpointEx(playerid, CP_SPAWN, 0.0, 0.0, 0.0, 5.0); //in some command SetPlayerCheckpointEx(playerid, CP_COMMAND, 0.0, 0.0, 0.0, 5.0);
And now at the end we can check what checkpoint the player is in
pawn Код:
public OnPlayerEnterCheckpoint(playerid) { switch(GetPVarInt(playerid, "checkpointid")) { case CP_SPAWN: { } case CP_COMMAND: { } } return true; }
A streamer does actually the same it just saves the checkpoint data and shows always the nearest
|
Ok, thank you