Accepting a command.
#3

pawn Код:
// /invite [id]
// id is in the variable userid.
// Check if the player has been invited already, so invites will not overwrite.
if(GetPVarInt(userid, "FactionID") != 0)
    return 1;

// Set the variable FactionID to the user selected.
SetPVarInt(userid, "FactionID", factionid);

// /acceptinvite
// Check the variable "FactionID" with GetPVar().
// If it exists or it is not zero, then the player has been invited.
// If so, when the command is sent, set him into the FactionID variable.
if(GetPVarInt(playerid, "FactionID") == 0)
    return 1;

// Set him into the faction.
var[playerid][faction] = GetPVarInt(playerid, "FactionID");

// Feel free to add a notification message.
SendClientMessage([...]);

// Always remember to delete temporary variables when you don't need them anymore.
DeletePVar(playerid, "FactionID");
Reply


Messages In This Thread
Accepting a command. - by SilencedPistol - 04.07.2013, 07:12
Re: Accepting a command. - by SilencedPistol - 04.07.2013, 14:47
Re: Accepting a command. - by GiamPy. - 04.07.2013, 15:47

Forum Jump:


Users browsing this thread: 3 Guest(s)