/r to pm's
#1

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
Reply
#2

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 */
Reply
#3

thanks man and this wont mess up when more then 2 players pm each other?

also how can i check if PvarInt isset ?
Reply
#4

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.
Reply
#5

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
Reply
#6

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.
Reply
#7

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)