SA-MP Forums Archive
help add use limiter - 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: help add use limiter (/showthread.php?tid=653970)



help add use limiter - nbx2000 - 18.05.2018

how can I set time limit to use the teles command to not agan spawn cmds.
use zcmd scanff2

Код:
CMD:dglobe(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][Jailed] == 1) return SendClientMessage(playerid,COLOR_BRIGHTRED,"You cannot escape      your punishment!");
	TeleTimer[playerid] = SetTimerEx("ttimer", 1000, true, "i",playerid);
	tseconds[playerid] = 6;
	format(tstring,45,"You Must wait %d seconds before teleporting", tseconds[playerid]-1);
	if(PlayerInfo[playerid][Level] == 0) SendClientMessage(playerid,COLOR_LIGHTBLUE, tstring);
	Tx[playerid] = 3994.595459;
	Ty[playerid] = 3996.388672;
	Tz[playerid] = 4.0;
	Ti[playerid] = 0;
	new string[128];
	new dsname[MAX_PLAYER_NAME];
	format(telestring[playerid],43,"Death Globe!");
	GetPlayerName(playerid, dsname, sizeof(dsname));
	format(string, sizeof(string), "[TELE]:%s has Just Teleported To The Death Globe /dglobe", dsname);
	SendClientMessageToAll(COLOR_LIGHTBLUE, string);
	SetTimerEx("setstunt",3000,0,"i", playerid);
	return 1;
}



Re: help add use limiter - CyNiC - 18.05.2018

pawn Код:
CMD:dglobe(playerid,params[]) {
    #pragma unused params
    if(PlayerInfo[playerid][Jailed] == 1) return SendClientMessage(playerid,COLOR_BRIGHTRED,"You cannot escape      your punishment!");
    //tseconds[playerid] = 6;
    if(PlayerInfo[playerid][Level] == 0) {
        if((gettime() - TeleTimer[playerid]) <= 6) {
            format(tstring,45,"You Must wait %d seconds before teleporting", gettime() - TeleTimer[playerid]);
            SendClientMessage(playerid,COLOR_LIGHTBLUE, tstring);
            return 1;
        }
    }
    Tx[playerid] = 3994.595459;
    Ty[playerid] = 3996.388672;
    Tz[playerid] = 4.0;
    Ti[playerid] = 0;
    TeleTimer[playerid] = gettime();//Gets the current time as a unix timestamp (seconds)
    new string[128];
    new dsname[MAX_PLAYER_NAME];
    format(telestring[playerid],43,"Death Globe!");
    GetPlayerName(playerid, dsname, sizeof(dsname));
    format(string, sizeof(string), "[TELE]:%s has Just Teleported To The Death Globe /dglobe", dsname);
    SendClientMessageToAll(COLOR_LIGHTBLUE, string);
    SetTimerEx("setstunt",3000,0,"i", playerid);
    return 1;
}