/r to pm's - 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: /r to pm's (
/showthread.php?tid=304336)
/r to pm's -
jamesbond007 - 18.12.2011
so whats the best way to create the command /r reply to your last received pm .. exactly like in Cb's cnr...
so if im ID 1 and i pm ID 2, ID 2 can use the command /r to reply back to ID 1
same goes for id 1 after 2 has replied him back, hope u understand. plz help=s
Re: /r to pm's -
Calgon - 18.12.2011
Create a PVar, or normal variable, storing the ID of the person who last PMed the player in the variable, then use /r to check that ID and send the reply to that ID.
In your PM command:
pawn Код:
/* for this explanation, iTarget is the player who is receiving the PM and playerid is the one sending it */
SetPVarInt(iTarget, "LastPMFrom", playerid);
In your reply command:
pawn Код:
new iTarget = GetPVarInt(playerid, "LastPMFrom");
/* iTarget being the target of the reply */
Re: /r to pm's -
jamesbond007 - 18.12.2011
thanks man and this wont mess up when more then 2 players pm each other?
also how can i check if PvarInt isset ?
Re: /r to pm's -
Calgon - 18.12.2011
If 2 people PM the person, the person will be able to reply to the last incoming PM.
If that's not what you want, could you be a bit more specific?
Also, you can use GetPVarType() and if it's 0, it's not a created PVar.
Re: /r to pm's -
jamesbond007 - 18.12.2011
Quote:
Originally Posted by Calgon
If 2 people PM the person, the person will be able to reply to the last incoming PM.
If that's not what you want, could you be a bit more specific?
Also, you can use GetPVarType() and if it's 0, it's not a created PVar.
|
ok thanks bro added +rep
Re: /r to pm's -
Lorenc_ - 18.12.2011
Quote:
Originally Posted by jamesbond007
thanks man and this wont mess up when more then 2 players pm each other?
also how can i check if PvarInt isset ?
|
pawn Код:
if(GetPVarInt(playerid, "RespondingID")) //if it's set
{
}
else //else if it isn't
{
}
EDIT: sorry was afk and waiting for the posting time to decrease.
Re: /r to pm's -
Calgon - 18.12.2011
Quote:
Originally Posted by Lorenc_
pawn Код:
if(GetPVarInt(playerid, "RespondingID")) //if it's set { } else //else if it isn't { }
EDIT: sorry was afk and waiting for the posting time to decrease.
|
That will trigger an error if the value is 0, if a PVar doesn't exist, it'll automatically return 0. Using GetPVarType will accurately determine whether the PVar currently exists or not.
Lorenc_'s code will not work for player ID 0.