SA-MP Forums Archive
Timer On Teleport - 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: Timer On Teleport (/showthread.php?tid=419026)



Timer On Teleport - Lemonaidz - 27.02.2013

Hello, i'm trying to put a timer on my teleport so people can only use the /telehome command once every Min.
iv'e looked on Wiki, and the timer made no sense to me, so how would i put a timer on this?:
Quote:

if(strcmp(cmdtext,"/Telehome",true)==0)
{
if(IsPlayerInAnyVehicle(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);
SetVehiclePos(vehicleid, 2167.8123,1422.5269,10.8203);
}
else
{
SetPlayerPos(playerid, 2167.8123,1422.5269,10.8203);
}
}
return 1;
}




Re: Timer On Teleport - RajatPawar - 27.02.2013

pawn Код:
// Use the one below, much better and faster.



Re: Timer On Teleport - zSuYaNw - 27.02.2013

Use gettime and global variables.

Try this,
pawn Код:
CMD:tele(playerid, params[]){
    #pragma unused params
   
   
    static
        go[MAX_PLAYERS]
    ;
   
    if((go[playerid] != 0) && gettime() - go[playerid] < 60){
        go[playerid] = gettime();
        return SendClientMessage(playerid, -1,"NOT");
    }
   
    go[playerid] = gettime();
    SetPlayerPos(playerid, 2167.8123,1422.5269,10.8203);
    return true;
}



Re: Timer On Teleport - Lemonaidz - 27.02.2013

Thx, But how do i put it in? Lol sorry im noob at this


Re: Timer On Teleport - mittukuttan - 27.02.2013

just copy this to ur script