/pm [id or name] [text/message] +REP+
#4

Quote:
Originally Posted by DarkScripter
Посмотреть сообщение
And Reply!

pawn Код:
#include <a_samp>
#include "../include/gl_common.inc"

#define COLOR_YELLOW                0xFFFF00AA
#define DIALOG_REPLY                50


new PlayerRecevied[MAX_PLAYERS];
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[128];
    new tmp[128];
    new idx;

    cmd = strtok(cmdtext, idx);
    if(!strcmp("/pm", cmd, true))
    {
        tmp = strtok(cmdtext,idx);

        if(!strlen(tmp) || strlen(tmp) > 5)
            return SendClientMessage(playerid,COLOR_YELLOW,"Usage: /pm (ID) (message)");

        if(!strlen(strrest(cmdtext,idx)))
            return SendClientMessage(playerid,COLOR_YELLOW,"Usage: /pm (ID) (message)");

        if(!IsPlayerConnected(strval(tmp)))
            return SendClientMessage(playerid,COLOR_YELLOW,"/pm : You Entered a Wrong ID!");

        if(playerid !=  strval(tmp))
            return SendClientMessage(playerid,COLOR_YELLOW,"You Cannot Private Message Yourself.");
       
        PlayerRecevied[strval(tmp] = playerid;
        PlayerPlaySound(strval(tmp),1085,0.0,0.0,0.0);
       
        ShowPlayerDialog(playerid, DIALOG_REPLY, DIALOG_STYLE_INPUT, "~ New Message ~", strrest(cmdtext,idx), "Reply", "Okay");
        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_REPLY)
    {
        if(response)
        {
            if(!strlen(inputtext))
            {
                SendClientMessage(playerid, -1,"||>> Put message !");
                ShowPlayerDialog(playerid, DIALOG_REPLY, DIALOG_STYLE_INPUT, "~ New Message ~", strrest(cmdtext,idx), "Reply", "Okay");
                return true;
            }

            ShowPlayerDialog(PlayerRecevied[playerid], DIALOG_REPLY, DIALOG_STYLE_INPUT, "~ New Message ~", inputtext, "Reply", "Okay");
        }
    }
    return true;
}
Thanks and I come up with these errors:

Код:
error 001: expected token: ",", but found "]"
error 017: undefined symbol "cmdtext"
Can you also add /r [message] to reply to the last message? Thanks so much!
Reply


Messages In This Thread
/pm [id or name] [text/message] +REP+ - by TheMightyEddy - 05.04.2012, 04:19
Re: /pm [id or name] [text/message] +REP+ - by DarkScripter - 05.04.2012, 06:42
Re: /pm [id or name] [text/message] +REP+ - by DannySnoopy - 05.04.2012, 07:41
Re: /pm [id or name] [text/message] +REP+ - by TheMightyEddy - 05.04.2012, 14:05
Re: /pm [id or name] [text/message] +REP+ - by TheMightyEddy - 05.04.2012, 19:49
Re: /pm [id or name] [text/message] +REP+ - by Twisted_Insane - 05.04.2012, 19:50
Re: /pm [id or name] [text/message] +REP+ - by ViniBorn - 05.04.2012, 19:53

Forum Jump:


Users browsing this thread: 1 Guest(s)