Three times command - 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: Three times command (
/showthread.php?tid=470564)
Three times command -
Shobi - 18.10.2013
how to make a variable to used three times commands
mean /healme
Re : Three times command -
Matnix - 18.10.2013
Example..
pawn Код:
new HealMax[MAX_PLAYERS];
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/heal", cmdtext, true, 5) == 0)
{
if(HealMax[playerid] != 3) // he don't use this command 3 time
{
// set player health to 100
HealMax[playerid]++; // + 1
}
else // he use this command 3 times
{
SendClientMessageToAll(color, "you can use this command only 3 time per life");
}
return 1;
}
return 0;
}// matnix
Re: Three times command -
Shobi - 18.10.2013
in zcmd please
Re: Three times command -
DobbysGamertag - 18.10.2013
Try this:
pawn Код:
new HealMax[MAX_PLAYERS];//set it to HealMax[playerid]=0; when they disconnect
CMD:healme(playerid,params[])
{
if(HealMax[playerid] != 3)
{
SetPlayerHealth(playerid,100);
HealMax[playerid]++;
}
else return SendClientMessage(playerid,-1,"You have met the max limit of 3 heals");
return 1;
}
Re: Three times command -
Chrillzen - 18.10.2013
EDIT: Too late.. ^
Re: Three times command -
Shobi - 18.10.2013
pawn Код:
D:\SERVER\filterscripts\script.pwn(132) : error 017: undefined symbol "HealMax"
D:\SERVER\filterscripts\script.pwn(132) : warning 215: expression has no effect
D:\SERVER\filterscripts\script.pwn(132) : error 001: expected token: ";", but found "]"
D:\SERVER\filterscripts\script.pwn(132) : error 029: invalid expression, assumed zero
D:\SERVER\filterscripts\script.pwn(132) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
Re: Three times command -
Kendo - 18.10.2013
new HealMax[MAX_PLAYERS];
Add this before the command