SA-MP Forums Archive
help with "if" - 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 with "if" (/showthread.php?tid=374595)



help with "if" - gnoomen2 - 03.09.2012

I got this

#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(pInfo[playerid][superadmin] == 0)) return SendClientMessage(playerid, COLOR_YELLOW, "You are not in Super Admin Mode.");
if(IsPlayerAdmin(playerid))
if (PRESSED(KEY_JUMP))
{
new
Float,
Float:y,
Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z + 10.0);
}
return 1;
}
COMMANDuperadmin(playerid, params[])
{
if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_YELLOW, "You are not an Rcon Admin.");
pInfo[playerid][superadmin] = 1;
SendClientMessage(playerid, COLOR_YELLOW, "You are now in Super Admin Mode.");
return 1;
}

error 029: invalid expression, assumed zero
warning 215: expression has no effect
error 001: expected token: ";", but found "return"

All on the "if(pInfo[playerid] etc line

There is something i do wrong with thorse if's after each other i think, but i don't know how i should set them up.


Re: help with "if" - CentyPoo - 03.09.2012

pawn Код:
if(pInfo[playerid][superadmin] == 0) return SendClientMessage(playerid, COLOR_YELLOW, "You are not in Super Admin Mode."); //had one too many )'s
You had one too many )'s at the end of the if statement.


Re: help with "if" - shamortiy - 03.09.2012

pawn Код:
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(pInfo[playerid][superadmin] == 0) return SendClientMessage(playerid, COLOR_YELLOW, "You are not in Super Admin Mode.");
if(IsPlayerAdmin(playerid))
if (PRESSED(KEY_JUMP))
{
new
Float,
Float:y,
Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z + 10.0);
}
return 1;
}
CMD:superadmin(playerid, params[])
{
if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_YELLOW, "You are not an Rcon Admin.");
pInfo[playerid][superadmin] = 1;
SendClientMessage(playerid, COLOR_YELLOW, "You are now in Super Admin Mode.");
return 1;
}



Re: help with "if" - gnoomen2 - 03.09.2012

Quote:
Originally Posted by CentyPoo
Посмотреть сообщение
pawn Код:
if(pInfo[playerid][superadmin] == 0) return SendClientMessage(playerid, COLOR_YELLOW, "You are not in Super Admin Mode."); //had one too many )'s
You had one too many )'s at the end of the if statement.
Haha, thanks, God.. should have known that xD