SA-MP Forums Archive
Last 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: Last checkpoint (/showthread.php?tid=392342)



Last checkpoint - Fernado Samuel - 13.11.2012

Removed


Re: Last checkpoint - NumbSkull - 13.11.2012

that is called cheating sir xD
but if it is an enum pos or w/e there are ways like
SetPlayerPos(playerid, CheckPoints[points][cpPosX], CheckPoints[points][cpPosY], CheckPoints[points][cpPosZ]);
<.<...


Re: Last checkpoint - tyler12 - 13.11.2012

pawn Код:
new Float:X[MAX_PLAYERS],Float:Y[MAX_PLAYERS],Float:Z[MAX_PLAYERS];

public OnPlayerEnterCheckpoint(playerid)
{
    GetPlayerPos(playerid,X[playerid],Y[playerid],Z[playerid]);
    return 1;
}

//Strcmp
public OnPlayerCommandText(playerid,cmdtext[])
{
    if(!strcmp(cmdtext,"/gotocp",false,11))
    {
        SetPlayerPos(playerid,X[playerid],Y[playerid],Z[playerid]);
        SendClientMessage(playerid,-1,"Teleported.");
        return 1;
    }
    return 0;
}

//Zcmd
CMD:gotocp(playerid,params[])
{
    SetPlayerPos(playerid,X[playerid],Y[playerid],Z[playerid]);
    SendClientMessage(playerid,-1,"Teleported.");
    return 1;
}



Re: Last checkpoint - Fernado Samuel - 13.11.2012

Removed


Re: Last checkpoint - NumbSkull - 13.11.2012

did you set x,y,z to global variable? you could set the x,y,z to a pvarfloat instead of global var and each player can have their own set still
also ...it will send you to the checkpoint you just passed thru ...so you need to go thru a checkpoint first


Re: Last checkpoint - Fernado Samuel - 13.11.2012

Removed


Re: Last checkpoint - NumbSkull - 13.11.2012

only use one of the CMDs if you use strcmp use the onplayercommandtext one if you use zcmd use the CMD: one and if they are set as race checkpoints use OnPlayerEnterRaceCheckpoint


Re: Last checkpoint - Fernado Samuel - 13.11.2012

Removed


Re: Last checkpoint - NumbSkull - 13.11.2012

i assume CPProgess[playerid] is the indicator for the checkpoint number to show? so to go to last you want to CPProgess[playerid]-1 like this
pawn Код:
CMD:gotolastcp(playerid,params[])
{
    SetPlayerPos(playerid,CPCoords[CPProgess[playerid]-1][0],CPCoords[CPProgess[playerid]-1][1],CPCoords[CPProgess[playerid]-1][2]);
    SendClientMessage(playerid,-1,"Teleported.");
    return 1;
}