PM command
#1

When you PM a player offline, it still sends the PM.
How do I fix this?

pawn Код:
CMD:pm(playerid, params[])
{
    new str[128],str2[128],message[100],id;
    if(sscanf(params,"is",id,message)) SendClientMessage(playerid,COLOR_GRAY,"USAGE: /pm [ID] [message]");
    if(!IsPlayerConnected(id)) SendClientMessage(playerid,COLOR_RED,"Invalid player ID!");
    if(id!=playerid){
        format(str,sizeof(str),"(( PM to [%i] %s: %s ))",id,GetName(id),message);
        format(str2,sizeof(str2),"(( PM from [%i] %s: %s ))",id,GetName(id),message);
        SendClientMessage(playerid,0xBF4C00AA,str);
        SendClientMessage(id,COLOR_ORANGE,str2);
        PlayerPlaySound(id,1058,0,0,0);
    }
    return 1;
}
Reply
#2

pawn Код:
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_RED,"Invalid player ID!");
//By this you're saying that !IsPlayerConnected is true, but if you add the return it prevents the command to be sent. while the other player is offline
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)