Checkpoints
#1

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

Come on people! Someone may know
Reply
#3

Omg...
Reply
#4

downlaod Incognito's checkpoint streamer there you'll find anythign you want:

https://sampforum.blast.hk/showthread.php?tid=102865
Reply
#5

Quote:
Originally Posted by Cjgogo
Посмотреть сообщение
downlaod Incognito's checkpoint streamer there you'll find anythign you want:

https://sampforum.blast.hk/showthread.php?tid=102865
Thanks.
Reply
#6

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

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)