Help Me :) - 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 Me :) (
/showthread.php?tid=550239)
Help Me :) -
samp_boy - 11.12.2014
i want that the player can use this command only 2 times how i can do this ? pleas
Код:
CMD:vheal(playerid)
{
if(pInfo[playerid][pVipLevel] >= 4)
{
new string[300], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"{00C0FF}%s {F3FF02}Has Used VIP SURVIVAL PACK {B20000}+25 Health",pName);
SendClientMessageToAll(0xFFFFFFAA,string);
new Float:hp;
GetPlayerHealth(playerid,hp);
SetPlayerHealth(playerid, hp + 15);
}
return 1;
}
Otherwise:
Re: Help Me :) -
Raweresh - 11.12.2014
So, declare new global variable for all players, example:
Код:
new PlayerUsedCommandTimes[MAX_PLAYERS];
Код:
CMD:vheal(playerid)
{
if(pInfo[playerid][pVipLevel] >= 4)
{
if(PlayerUsedCommandTimes[playerid] == 2)
{
//When player used this command 2 times.
return 1;
}
PlayerUsedCommandTimes[playerid]++;
new string[300], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"{00C0FF}%s {F3FF02}Has Used VIP SURVIVAL PACK {B20000}+25 Health",pName);
SendClientMessageToAll(0xFFFFFFAA,string);
new Float:hp;
GetPlayerHealth(playerid,hp);
SetPlayerHealth(playerid, hp + 15);
}
return 1;
}
Don't forget to reset this variable when player connect.
Re : Help Me :) -
samp_boy - 11.12.2014
+Rep
You Saved My life Thanks