else if (strcmp(cmd, "sethp", true) == 0) {
new snick[256], plr, health[256], szMsg[256];
snick = strtok(cmdtext, idx), plr = FindPlayerIDFromString(snick), health = strtok(cmdtext, idx);
if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
else if(!IsPlayerCommandLevel(playerid,"sethp")) SendClientMessage(playerid, COLOR_RED, "You don't have access to use this command!");
else if(!IsPlayerCommandLevel1(playerid,"sethp")) SendClientMessage(playerid, COLOR_RED, "You don't have access to use this command!");
else if (!strlen(health)) SendClientMessage(playerid,COLOR_GREEN,"USAGE: /c sethp [Nick/ID] [Armour]");
else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");
else {
format(szMsg,sizeof(szMsg),"Admin %s changed:[ %s ] health to:[ %d% ]",gPlayers[playerid],gPlayers[plr],strval(health));
SendClientMessageToAll(COLOR_GREEN,szMsg);
SetPlayerHealth(plr,strval(health));
}
return 1;
}
else if (strcmp(cmd, "healall", true) == 0) {
if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
else if(!IsPlayerCommandLevel(playerid,"healall")) SendClientMessage(playerid, COLOR_RED, "You don't have access to use this command!");
else {
HealAll();
}
return 1;
}
Everyone can fix my code to fit two conditions to use the command.
I have corrected, but this condition shall not be other conditions
Expect people to help
Thanks