Faction System
#1

Hey guys i have a question how can i solve this error?

Код:
C:\Users\Jaua\Downloads\gta-rp\gamemodes\LIMPIO.pwn(704) : error 028: invalid subscript (not an array or too many subscripts): "pAdmin"
C:\Users\Jaua\Downloads\gta-rp\gamemodes\LIMPIO.pwn(704) : warning 215: expression has no effect
C:\Users\Jaua\Downloads\gta-rp\gamemodes\LIMPIO.pwn(704) : error 001: expected token: ";", but found "]"
C:\Users\Jaua\Downloads\gta-rp\gamemodes\LIMPIO.pwn(704) : error 029: invalid expression, assumed zero
C:\Users\Jaua\Downloads\gta-rp\gamemodes\LIMPIO.pwn(704) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
this is my code:

PHP код:
/*******************************************************************************
                                FACTION SYSTEM
*******************************************************************************/
CMD:makeleader(playeridparams[])
{
    new 
targetidfactionidstring[128], targetname[24], playername[24];
    if(
sscanf(params"ui"targetidfactionid)) return SendClientMessage(playerid, -1"Usage: /makeleader [playerid][factionid]"); //Checks if they typed in anything for the playerid and factionid parameters, and if they don't, return a client message.
    
if(pAdmin[playerid] != 6) return SendClientMessage(playerid, -1"You are not an Admin"); //Checks if they are an admin.  Remember, change this to your admin variable, or use !IsPlayerAdmin to check if they aren't rcon admin.
    
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1"Invalid player id!"); //Sends a message if the player is not connected
    
if(factionid 3//Checks if the factionid is between 0 and 3, and if so, continue.  You can also type this like so: if(factionid >= 1 && factionid <= 2) or if(factionid == 1 || factionid == 2)
    
{
        
GetPlayerName(playeridplayernamesizeof(playername)); //Gets the players name and saves it to the variable playername
        
GetPlayerName(targetidtargetnamesizeof(targetname)); //Gets the targets name and saves it to the variable targetname
        
format(stringsizeof(string), "You made %s leader of faction id %i!"targetnamefactionid); //Formats the string that you will receive
        
SendClientMessage(playerid, -1string); //Sends a message to the person who changes the other persons faction in a random color
        
format(stringsizeof(string), "You were made leader of faction id %i by %s"factionidplayername);//Formats the string that the player will receive
        
SendClientMessage(playerid, -1string); //Sends a message to the person who is made the faction leader
        
PlayerInfo[playerid][Faction] == factionid;
        
PlayerInfo[playerid][Rank] == 6//Leader, use a switch case or if/else if statement if you want to make it so certain factions have seperate highest ranks
    
}
    else return 
SendClientMessage(playerid, -1"Invalid faction ID.  Faction ID's: 1-2"); //Sends a message if the faction is NOT between 0 and 3
    
return 1;// Returns 1 to end the command, as we NEED to return a value.
}
CMD:removefromfaction(playeridparams[]) //Format to create a command
//Open bracket
    
new targetidtargetname[24], playername[24], string[128]; //Create the variables
    
if(sscanf(params"u"targetid)) return SendClientMessage(playerid, -1"Usage: /removefromfaction [playerid/partofname]"); //Sends message if they do not type something in for the targetid/name
    
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1"Invalid playerid!"); //Sends a message if the player isn't connected
    
if(AdminVariable[playerid] != && PlayerInfo[playerid][Rank] != 6) return SendClientMessage(playerid, -1"You are not a high enough admin or you aren't the leader!"); //Sends a message if they aren't the leader of the faction and if they aren't admin
    
GetPlayerName(targetidtargetnamesizeof(targetname)); //Stores the targetid's name in the targetname variable
    
GetPlayerName(playeridplayernamesizeof(playername)); //Stores the playerid's name in the playername variable
    
format(stringsizeof(string), "You removed %s from his (now) previous faction!"targetname);//Formats the message that will be sent to you (the player)
    
SendClientMessage(playerid, -1string);//Sends the message that is formatted above to the playerid in a random color
    
format(stringsizeof(string), "You were removed from your faction by %s!"playername);//Formats the message that will be sent to the targetid
    
SendClientMessage(targetid, -1string);//Sends the message that is formatted above to the targetid in a random color
    
PlayerInfo[targetid][Faction] == 0//Sets their faction variable to 0 (civilian)
    
PlayerInfo[targetid][Rank] == 0//Sets their rank variable to 0 (no rank)
    
return 1//Returns a value
//Closed bracket
CMD:setrank(playeridparams[])
{
    new 
targetidranktargetname[24], playername[24], string[128]; //Creates our variable
    
if(sscanf(params"ui"targetidrank)) return SendClientMessage(playerid, -1"Usage: /setrank [playerid/partofname][rank]"); //Sends correct usage if they do not type in the rank and playerid
    
if(PlayerInfo[playerid][Rank] != 6) return SendClientMessage(playerid, -1"You are not the leader of a faction!"); //If their rank is not 6, send the message.  Their rank won't be 6 unless they are in a faction, no need to check their faction
    
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1"That player is not connected!"); //Sends a message if the targetid is not connected
    
if(PlayerInfo[targetid][Faction] != PlayerInfo[playerid][Faction]) return SendClientMessage(playerid, -1"That player is not in your faction!"); //Sends a message if the targetid is not in their faction
    
if(rank 7//If the rank is between 0 and 7, seeing as below 1 and above 6 is not a valid rank
    
//Open bracket
        
GetPlayerName(playeridplayernamesizeof(playername)); //Stores the playerid's name into the playername variable
        
GetPlayerName(targetidtargetnamesizeof(targetname)); //Stores the targetid's name into the targetname variable
        
if(PlayerInfo[targetid][Rank] < rank//If the players rank is less than the rank being given (promotion)
        
//Open bracket
            
format(stringsizeof(string), "You have been promoted to rank %i by %s!"rankplayername); //Formats the message for the targetid
            
SendClientMessage(targetid, -1string); //Sends formatted message to targetid
            
format(stringsizeof(string), "You promoted %s to rank %i"targetnamerank); //Formats the message for the playerid
            
SendClientMessage(playerid, -1string); //Sends formatted message to playerid
        
//Closed bracket
        
else //Else (demotion)
        
//Open bracket
            
format(stringsizeof(string), "You have been demoted to rank %i by %s!"rankplayername); //Same as above
            
SendClientMessage(targetid, -1string); //Same as above
            
format(stringsizeof(string), "You demoted %s to rank %i"targetnamerank); //Same as above
            
SendClientMessage(playerid, -1string); //Same as above
        
//Closed bracket
    
//Closed bracket
    
return 1//Return a value
}
if(
PlayerInfo[playerid][Faction] == 1//If the faction is 1
if(PlayerInfo[playerid][Faction] == || PlayerInfo[playerid][Faction] == 2//Checks if it is faction 1 or 2
if(pData[playerid][Faction] < 3//Checks if it is between 0 and 3
if(PlayerInfo[playerid][Faction] != 0//If the faction is not 0
if(PlayerInfo[playerid][Faction] == && pData[playerid][Rank] == 6//If the faction is 1 and the rank is 6
//How do I check if something is 1 AND something else is 2
//&& == and, || == or, use accordingly like shown above 
Reply


Messages In This Thread
Faction System - by Jaua10 - 14.10.2017, 16:49
Re: Faction System - by Meller - 14.10.2017, 16:50
Re: Faction System - by Escobabe - 14.10.2017, 16:55
Re: Faction System - by elhanan - 14.10.2017, 16:55
Re: Faction System - by Jaua10 - 14.10.2017, 16:59
Re: Faction System - by Kraeror - 14.10.2017, 16:59
Re: Faction System - by Kraeror - 14.10.2017, 17:01
Re: Faction System - by Jaua10 - 14.10.2017, 17:17
Re: Faction System - by Kraeror - 14.10.2017, 17:21
Re: Faction System - by Jaua10 - 14.10.2017, 17:23

Forum Jump:


Users browsing this thread: 1 Guest(s)