Enum help - 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: Enum help (
/showthread.php?tid=427392)
Enum help -
NicholasA - 01.04.2013
I want to make a cmd that will toggle something I know it will use enums this is something what i tought:
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/afk", cmdtext, true, 10) == 0)
{
If user = afk then
print("You are no longer AFK!")
Else
print("You are now afk!")
End if
return 1;
}
return 0;
}
I know the code is not right, I stopped with pawn for a while so bear with me
Re: Enum help -
iGetty - 01.04.2013
pawn Code:
new bool:IsAFK[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
IsAFK[playerid] = false;
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/afk", cmdtext, true, 4) == 0)
{
if(IsAFK[playerid] == false)
{
SendClientMessage(playerid, -1, "You are now AFK!")
IsAFK[playerid] = true;
}
else
{
IsAFK[playerid] = false;
SendClientMessage(playerid, -1, "You are not AFK anymore.");
}
return 1;
}
return 0;
}