SA-MP Forums Archive
Need some help - 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: Need some help (/showthread.php?tid=640548)



Need some help - 1fret - 04.09.2017

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


Re: Need some help - coool - 04.09.2017

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


Re: Need some help - kAn3 - 04.09.2017

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.