whats wrong with that? thats how it should be? abit more discription would be helpful for us buddy
Put the admin check under if (!IsPlayerConnected(..)) and return 1; inside of it.
If you want one of them to show up, depending on whether the sender if an admin or not, you need to make two if statements checking if they're admin or not. Also, the two string sizes don't need to be more than 128 and be sure to include that in the sscanf check as it could return warnings/errors in the server logs.
pawn Код:
CMD:pm(playerid,params[])
{
new id,msg[128],str2[128];
if(sscanf(params,"us[128]",id,str2)) return SendClientMessage(playerid,-1,"USAGE: /pm [playerid] [Message]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"Error: That Player Is Not Connected");
format(msg,sizeof(msg),"PM To %s (ID: %d): %s",pName(id),id,str2);
SendClientMessage(playerid,0xFF00FFFF,msg);
if(PlayerInfo[playerid][pAdmin] >= 1)
{
format(msg,sizeof(msg),"PM From Admin %s (ID: %d): %s",pName(playerid),playerid,str2);
SendClientMessage(id,0xFF00FFFF,msg);
}
else
{
format(msg,sizeof(msg),"PM From %s (ID: %d): %s",pName(playerid),playerid,str2);
SendClientMessage(id,0xFF00FFFF,msg);
}
return 1;
}
PHP код:
if(sscanf(params,"us[128]", id, str2))