Help with /reply command
#1

Can someone show me how to make a fast /reply command which will reply to latest message without typing the ID ?

pawn Код:
if(strcmp(cmd, "/pm",true) == 0)
        {
            new tmp[256];
            tmp=strtok(cmdtext,idx);
            if(!strlen(tmp)) return SendClientUsage(playerid,cmd,"[PartOfName/ID] [message]");
            TargetUser(tmp,playerid)
            if(PlayerTemp[giveplayerid][pmlock]) return SendClientError(playerid,"This player has locked his incomming PM");
            tmp=strrest(cmdtext,idx);
            if(!strlen(tmp)) return SendClientUsage(playerid,cmd,"[PartOfName/ID] [message]");
            if(FindIP(tmp))
            {
                KickReas("[SERVER]",playerid,"Atempting to advertise IP's!");
                return 1;
            }
            new stringa[MAX_STRING];
            format(stringa,sizeof(stringa),"[PM Sent to %s[%i]: %s]",PlayerName(giveplayerid),giveplayerid,tmp);
            SendClientMessage(playerid,COLOR_PLAYER_LIGHTBLUE,stringa);
            format(stringa,sizeof(stringa),"[PM From %s[%i]: %s]",PlayerName(playerid),playerid,tmp);
                new floriansxazuttfzbuikz[600];
                format(floriansxazuttfzbuikz, sizeof(floriansxazuttfzbuikz), "7,6[ PM ] %s[%d] to %s[%d]: %s",NameEx(playerid),playerid,NameEx(giveplayerid),giveplayerid,tmp);
                IRC_GroupSay(gGroupID, IRC_CHANNEL,floriansxazuttfzbuikz);
            SendClientMessage(giveplayerid,COLOR_PLAYER_LIGHTBLUE,stringa);
            return 1;
        }
Reply
#2

pawn Код:
new PmSender[MAX_PLAYERS]=-1;//<---- add this on top of the script

       if(strcmp(cmd, "/pm",true) == 0)
        {
            new tmp[256];
            tmp=strtok(cmdtext,idx);
            if(!strlen(tmp)) return SendClientUsage(playerid,cmd,"[PartOfName/ID] [message]");
            TargetUser(tmp,playerid)
            if(PlayerTemp[giveplayerid][pmlock]) return SendClientError(playerid,"This player has locked his incomming PM");
            tmp=strrest(cmdtext,idx);
            if(!strlen(tmp)) return SendClientUsage(playerid,cmd,"[PartOfName/ID] [message]");
            if(FindIP(tmp))
            {
                KickReas("[SERVER]",playerid,"Atempting to advertise IP's!");
                return 1;
            }
            new stringa[MAX_STRING];
            format(stringa,sizeof(stringa),"[PM Sent to %s[%i]: %s]",PlayerName(giveplayerid),giveplayerid,tmp);
            SendClientMessage(playerid,COLOR_PLAYER_LIGHTBLUE,stringa);
            format(stringa,sizeof(stringa),"[PM From %s[%i]: %s]",PlayerName(playerid),playerid,tmp);
            new floriansxazuttfzbuikz[600];
            format(floriansxazuttfzbuikz, sizeof(floriansxazuttfzbuikz), "7,6[ PM ] %s[%d] to %s[%d]: %s",NameEx(playerid),playerid,NameEx(giveplayerid),giveplayerid,tmp);
            IRC_GroupSay(gGroupID, IRC_CHANNEL,floriansxazuttfzbuikz);
            PmSender[giveplayerid]=playerid;//<--- add this- this stores the last pm sender
            SendClientMessage(giveplayerid,COLOR_PLAYER_LIGHTBLUE,stringa);
            return 1;
        }
       
        if(strcmp(cmd, "/reply")==0)
        {
            if(PmSender[playerid]==-1)return SendClientMessage(playerid,0xFFFFFFFF,"None has sent you pm.");//ADDED AFTER FIRST reply
            if(!IsPlayerConnected(PmSender[playerid]))return SendClientMessage(playerid,0xFFFFFFFF,"Player has just logged off");
            new tmp[256];
            tmp=strrest(cmdtext,idx);
            SendClientMessage(PmSender[playerid],COLOR_PLAYER_LIGHTBLUE,tmp);
            PmSender[PmSender[playerid]]=playerid;
            return 1;
        }
Reply
#3

How to make if player didnt receive message it will show up an Error Noone sent you PM?
Reply
#4

edited first post
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)