Need some help
#1

I got this rp gamemode from a friend anyways, im trying to make it so that if you get invited to a faction you got to /accept it but the /invite command works but when they do /accept faction it doesnt work
This is under the /accept faction command
PHP код:
    else if(!strcmp(params"faction"true))
    {
        if(
GetPVarInt(playerid"InvitedToFaction"))
        {
            
Invite(playeridGetPVarInt(playerid"InvitedToFaction"), PlayerName(playerid));
            
SetPVarInt(playerid"InvitedToFaction"0);
        }
        return 
1;
    } 
PHP код:
COMMAND:invite(playeridparams[])
{
    if(
PlayerInfo[playerid][ranklvl] > 1) return SendClientError(playeridCANT_USE_CMD);
    if(
PlayerInfo[playerid][playerteam] == CIV) return SendClientError(playeridCANT_USE_CMD);
    new 
iPlayer;
    if( 
sscanf params"u"iPlayer)) return SCP(playerid"[PlayerID/PartOfName]");
    if(!
IsPlayerConnected(iPlayer) || iPlayer == playerid) return SendClientError(playeridPLAYER_NOT_FOUND);
    if(
GetPlayerFaction(iPlayer) != CIV) return SendClientError(playerid"Player is not a civilian!");
    if(
PlayerInfo[iPlayer][playerlvl] < && PlayerInfo[playerid][playerteam] != COPS)
    return 
SendClientError(playerid,   "The player is level 1.");
    
SetPVarInt(iPlayer"InvitedToFaction"PlayerInfo[playerid][playerteam]);
    
format(iStrsizeof(iStr), "%s has invited you to join %s. Use ~r~/accept faction~w~ to join %s."RPName(playerid), PlayerInfo[playerid][PTeamName],PlayerInfo[playerid][PTeamName]);
    
ShowInfoBox(iPlayer"Faction Invite"iStr);
    return 
1;

The /invite command works well only the accept park doesnt work
Reply
#2

Is the "PlayerInfo[playerid][playerteam]" value = 0?
Or it can be a bug in the 'Invite' function.
Reply
#3

Try to:
Код:
    else if(!strcmp(params, "faction", true))
    {
        if(GetPVarInt(playerid, "InvitedToFaction") != 0)
        {
            Invite(playerid, GetPVarInt(playerid, "InvitedToFaction"), PlayerName(playerid));
            SetPVarInt(playerid, "InvitedToFaction", 0);
            SendClientMessageToAll(-1, "The code at line X has been read");
        }
        return 1;
    }
Sending a client message to all can be useful to see whether this part of the code is read or not.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)