Admin ammunition every 10 mins. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Admin ammunition every 10 mins. (
/showthread.php?tid=252531)
Admin ammunition every 10 mins. -
Vvolk - 01.05.2011
I have a problem I want to do command which give for admins weapons,armour and health But admin can use this command every 10mins how I can do this? I think there need to be SetTimer ![Cool](images/smilies/cool.gif)
My code under OnPlayerCommandText:
Код:
if (strcmp("/adminammunition, cmdtext, true, 10) == 0)
{
if(isPlayerAnAdmin(playerid,2))
{
SetPlayerHealth(playerid,100);
SetPlayerArmour(playerid,100);
GivePlayerWeapon(playerid,31,100);
GivePlayerWeapon(playerid,41,500);
SendClientMessage(playerid,0xFF66FFAA," You get admin ammunition.");
return 1;
}
else
{
SendClientMessage(playerid,0x4B00B0AA,"You are not an admin...");
return 1;
}
}
}
Plesae correct my code... I need this.
Re: Admin ammunition every 10 mins. - Emmet_ - 01.05.2011
pawn Код:
if (strcmp("/adminammunition", cmdtext, true) == 0)
{
if(isPlayerAnAdmin(playerid,2))
{
new ammun = GetPVarInt(playerid, "ammunition");
if (ammun) return 1;
SetPVarInt(playerid, "ammunition", 1);
SetTimerEx("resetammun", 600 * 1000, false, "i", playerid);
SetPlayerHealth(playerid,100);
SetPlayerArmour(playerid,100);
GivePlayerWeapon(playerid,31,100);
GivePlayerWeapon(playerid,41,500);
SendClientMessage(playerid,0xFF66FFAA," You get admin ammunition.");
return 1;
}
else
{
SendClientMessage(playerid,0x4B00B0AA,"You are not an admin...");
}
return 1;
}
// Put this code at the end of your script:
public resetammun(playerid)
{
SetPVarInt(playerid, "ammunition", 0);
return 1;
}
Re: Admin ammunition every 10 mins. -
Vvolk - 02.05.2011
Thank you very much respect for you...
Re: Admin ammunition every 10 mins. -
xir - 02.05.2011
You could use GetTickCount