Problem with /pm cmd
#8

@blackwave,your code returns lots of "pName shadows a variable at precedeing level".


Xeploit,i edited in this way:

Код:
dcmd_pm(playerid, params[])
    {
    new pMessage[128];
    new gMessage[128];
    new pName[MAX_PLAYER_NAME+1];
    new iName[MAX_PLAYER_NAME+1];
        if(!strlen(params) || strlen(params) > 5) {
            SendClientMessage(playerid,COLOR_YELLOW,"Usage: /pm (id) (message)");
            return 1;
        }
        new id = strval(params);
        if(!strlen(gMessage)) {
            SendClientMessage(playerid,COLOR_YELLOW,"Usage: /pm (id) (message)");
            return 1;
        }
        if(!IsPlayerConnected(id)) {
            SendClientMessage(playerid,COLOR_YELLOW,"/pm : Bad player ID");
            return 1;
        }
        if(playerid != id) {
            GetPlayerName(id,iName,sizeof(iName));
            GetPlayerName(playerid,pName,sizeof(pName));
            format(pMessage,sizeof(pMessage),"<Private Message to %s(%d): %s",iName,id,gMessage);
            SendClientMessage(playerid,COLOR_YELLOW,pMessage);
            format(pMessage,sizeof(pMessage),">Private Message from %s(%d): %s",pName,playerid,gMessage);
            SendClientMessage(id,COLOR_YELLOW,pMessage);
            new str[100];
            format(str,sizeof str," **PM from %s (%d) to %s (%d): %s",pName,playerid,iName,id,gMessage);
            SendMessageToAdmins(COLOR_GREEN,str);
            new str1[100];
            format(str1,sizeof str1,"0,5PM from %s (%d) to %s (%d): %s",pName,playerid,iName,id,gMessage);
            IRC_GroupSay(gGroupID, IRC_CHANNEL, str1);
            printf(pMessage);
            PlayerPlaySound(id,1085,0.0,0.0,0.0);
            printf("PM: %s",pMessage);
        }
        else {
            SendClientMessage(playerid,COLOR_YELLOW,"You cannot PM yourself");
        }
        return 1;
}
But if i do /pm 1 test

it show me the normal message: /pm id message

And doesnt work.
Reply


Messages In This Thread
Problem with /pm cmd - by Face9000 - 19.12.2010, 17:31
Re: Problem with /pm cmd - by Mr L - 19.12.2010, 17:32
Re: Problem with /pm cmd - by Face9000 - 19.12.2010, 17:34
Re: Problem with /pm cmd - by Face9000 - 20.12.2010, 20:39
Re: Problem with /pm cmd - by XePloiT - 20.12.2010, 20:41
Re: Problem with /pm cmd - by iggy1 - 20.12.2010, 20:42
Re: Problem with /pm cmd - by blackwave - 20.12.2010, 20:44
Re: Problem with /pm cmd - by Face9000 - 20.12.2010, 20:52
Re: Problem with /pm cmd - by iggy1 - 20.12.2010, 20:56
Re: Problem with /pm cmd - by XePloiT - 20.12.2010, 20:56

Forum Jump:


Users browsing this thread: 1 Guest(s)