if(IsPlayerConnected(playerid))
{
code blah blah blah
}
if(IsPlayerAdmin(playerid))
{
Code blah blah blah
}
if(IsPlayerConnected(playerid))
{
if(IsACop(playerid)
{
if(PlayerInfo[playerid] [pRank] < 5)
{
code blah blah blah
}
// Check if the player is connected
if (IsPlayerConnected(playerid))
{
// The player is connected, now check if he is a cop
if (IsACop(playerid))
{
// Here the player is connected AND he's a cop, now we need to check if he's also an admin
if (PlayerInfo[playerid][pRank] < 5)
{
// Code here to execute: the player is connected, he's a cop AND also is an admin
}
else
{
// The player is connected, AND he's a cop, but he's not an admin
}
}
else
{
// The player is connected, but he's not a cop
}
}
else
{
// The player is not connected
}
// If the player is NOT connected, exit the function
if (IsPlayerConnected(playerid) == 0) return 1;
// Here the player is connected, check if he's a cop now and exit the function if he's NOT a cop
if (IsACop(playerid) == 0) return 1;
// Here the player is connected AND a cop, now check if he's an admin (if not, exit the function)
if (PlayerInfo[playerid][pRank] < 5) return 1;
// Here the player is connected, he's a cop AND he's an admin, so execute the code for your pm system
In your code, there is no "else" statement.
pawn Код:
|
if(strcmp(cmd, "/pm", true) == 0 || strcmp(cmd, "/privatemessage", true) == 0) //db
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " You havent logged in yet !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/p)rivate(m)essage [playerid/PartOfName] [message text]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(HidePM[giveplayerid] > 0)
{
SendClientMessage(playerid, COLOR_GREY, " That player is blocking PMs !");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
if(giveplayerid == playerid)
{
format(string, sizeof(string), "* %s mutters somthing.", sendername);
ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/p)rivate(m)essage [playerid/PartOfName] [message text]");
return 1;
}
format(string, sizeof(string), "%s(ID: %d) PMs:(( %s ))", sendername, playerid, (result));
SendClientMessage(giveplayerid, COLOR_ORANGE, string);
format(string, sizeof(string), "PM sent to %s(ID: %d):(( %s ))", giveplayer, giveplayerid, (result));
SendClientMessage(playerid, COLOR_ORANGE, string);
// PMLog(string[]);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(BigEar[i])
{
format(string, sizeof(string), "%s (%d) PMs to %s (%d): %s", sendername, playerid, giveplayer, giveplayerid, (result));
SendClientMessage(i, COLOR_GREEN, string);
}
}
return 1;
}
}
else
{
format(string, sizeof(string), " %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}
if(IsPlayerConnected(playerid))
{
code blah blah blah
}
if(IsPlayerAdmin(playerid))
{
Code blah blah blah
}
if(IsPlayerConnected(playerid))
{
if(IsACop(playerid)
{
if(PlayerInfo[playerid] [pRank] < 5)
{
code blah blah blah
}
}
}
if(gPlayerLogged[playerid] == 0) { SendClientMessage(playerid, COLOR_GREY, " You havent logged in yet !"); return 1; }
if(PlayerInfo[playerid] [pAdmin] == 0) { SendClientMessage(playerid, COLOR_GREY, " You're not allowed to use this command!"); return 1; }
if(PlayerInfo[playerid] [pAdmin] == 0) return SendClientMessage(playerid, COLOR_GREY, " You're not allowed to use this command!");
if(!PlayerInfo[playerid] [pAdmin]) return SendClientMessage(playerid, COLOR_GREY, " You're not allowed to use this command!");
if(PlayerInfo[playerid] [pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY, " You're not allowed to use this command!");