SA-MP Forums Archive
Command /re - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Command /re (/showthread.php?tid=357773)



Command /re - deltapro - 08.07.2012

Hello.. Who can help me about making on /re ... i don't wanna write always ex. /pm 1 blabla .. just /re .. /re ,means reply to last who pmed you ) If you think what i mean ...


Re: Command /re - clarencecuzz - 08.07.2012

Might look something like this:
pawn Код:
new LastPM[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
LastPM[playerid] = playerid;
return 1;
}

//PM command Here
LastPM[player1] = playerid; //Replace player1 with the variable you used to define the player that received the message.

//re command Here
if(LastPM[playerid] != playerid)
SendClientMessage(LastPM[playerid], etc....



Re: Command /re - Roko_foko - 08.07.2012

Give me your code with /pm I will modify it and give you completed code


Re: Command /re - deltapro - 08.07.2012

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;
                        }



Re: Command /re - Roko_foko - 08.07.2012

pawn Код:
//At the top of your script
new Sender[MAX_PLAYERS]=-1;//NEW

//under OnPlayerCOmmandText
    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);
            Sender[giveplayerid]=playerid// NEW
            return 1;
    }
   if(strcmp(cmd, "/re",true)==0)//NEW
   {
            new tmp[256];
            if(cmd[3]=='\0')return SendClientUsage(playerid,cmd,"/re [message]");
            if(cmd[3]==' ')
            {
                if(PlayerTemp[Sender[playerid]][pmlock]) return SendClientError(playerid,"This player has locked his incomming PM");
                format(tmp,256,"%s",cmd[4]);
                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(Sender[playerid]),Sender[playerid],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(Sender[playerid]),Sender[playerid],tmp);
                IRC_GroupSay(gGroupID, IRC_CHANNEL,floriansxazuttfzbuikz);
                SendClientMessage(Sender[playerid],COLOR_PLAYER_LIGHTBLUE,stringa);
                 Sender[Sender[playerid]]=playerid; //I EDITED THIS AFTER, SO THEY CAN CHAT VIA /re Only untill next /pm
            return 1;

            }
   }
Try this.


Re: Command /re - deltapro - 08.07.2012

+1 rep from me.. thanks for helping )