29.04.2012, 12:10
(
Последний раз редактировалось Niko_boy; 29.04.2012 в 12:40.
)
create a playe rvariable
new IsUsed[MAX_PLAYERS];
at top
then in command do like
if(IsUsed[playerid] == 1 ) return SendClientMessage(playerid, -1, "You Just used command");
so it will be like :-
and :-
a new public function
Code:
some where down the script
this isnt fastest and best method though i have only tried this.
Also i Guess to do like this there will be needed for many new player variables; cause its command specific.
^fail english sorry.
=-----------=
You can also use OnCommandRecieved Function but i never tried it
new IsUsed[MAX_PLAYERS];
at top
then in command do like
if(IsUsed[playerid] == 1 ) return SendClientMessage(playerid, -1, "You Just used command");
so it will be like :-
pawn Код:
dcmd_wank(playerid, params[])
{
new id;
if(IsUsed[playerid] == 1 ) return SendClientMessage(playerid, -1, "You Just used command");
if(gTeam[playerid] == TEAM_COP || gTeam[playerid] == TEAM_ARMY || gTeam[playerid] == TEAM_CIA) return SendClientMessage(playerid, -1, "Cops, CIA, and Army cannot wank!");
if(sscanf(params, "u",id)
{
SendClientMessage(playerid, -1, "You wanked in public on nobody.. wanted level increased");
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 1);
}
else
{
new name[24], string[128];
GetPlayerName(id, name, sizeof name);
format(string, sizeof string, "You wanked on %s, wanted level increased!", name);
SendClientMessage(playerid, -1, string);
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 3);
}
IsUsed[Playerid] = 1;
SetTimerEx("UsedReset",false,3*10000,"i",playerid);// 10000 = 1 minute so i did 3* to multiply it by 3 so it will be 3 minutes now
return 1;
}
a new public function
Code:
pawn Код:
forward UsedReset(playerid);// at top
public UsedReset(playerid)
{
IsUsed = 0;
}
this isnt fastest and best method though i have only tried this.
Also i Guess to do like this there will be needed for many new player variables; cause its command specific.
^fail english sorry.
=-----------=
You can also use OnCommandRecieved Function but i never tried it