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
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;
}
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;
}
}
+1 rep from me.. thanks for helping