Errors
#1

i need help on errors factions



Код:
C:\Users\Derick\pawno\include\PPC_PlayerCommands.inc(5197) : error 017: undefined symbol "AdminVariable"
C:\Users\pawno\include\PPC_PlayerCommands.inc(5197) : warning 215: expression has no effect
C:\Users\pawno\include\PPC_PlayerCommands.inc(5197) : error 001: expected token: ";", but found "]"
C:\Users\pawno\include\PPC_PlayerCommands.inc(5197) : error 029: invalid expression, assumed zero
C:\Users\pawno\include\PPC_PlayerCommands.inc(5197) : fatal error 107: too many error messages on one line

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


4 Errors.
Код:
CMD:makeleader(playerid, params[])
{
    new targetid, factionid, string[128], targetname[24], playername[24];
    if(sscanf(params, "ui", targetid, factionid)) 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(AdminVariable[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 playerid!"); //Sends a message if the player is not connected
    if(0 < 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(playerid, playername, sizeof(playername)); //Gets the players name and saves it to the variable playername
        GetPlayerName(targetid, targetname, sizeof(targetname)); //Gets the targets name and saves it to the variable targetname
        format(string, sizeof(string), "You made %s leader of faction id %i!", targetname, factionid); //Formats the string that you will receive
        SendClientMessage(playerid, -1, string); //Sends a message to the person who changes the other persons faction in a random color
        format(string, sizeof(string), "You were made leader of faction id %i by %s", factionid, playername);//Formats the string that the player will receive
        SendClientMessage(playerid, -1, string); //Sends a message to the person who is made the faction leader
        pData[playerid][Faction] == factionid;
        pData[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 factionid.  Factionid'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(playerid, params[]) //Format to create a command
{ //Open bracket
    new targetid, targetname[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 (APlayerData[playerid][PlayerLevel] >= 7) && pData[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(targetid, targetname, sizeof(targetname)); //Stores the targetid's name in the targetname variable
    GetPlayerName(playerid, playername, sizeof(playername)); //Stores the playerid's name in the playername variable
    format(string, sizeof(string), "You removed %s from his (now) previous faction!", targetname);//Formats the message that will be sent to you (the player)
    SendClientMessage(playerid, -1, string);//Sends the message that is formatted above to the playerid in a random color
    format(string, sizeof(string), "You were removed from your faction by %s!", playername);//Formats the message that will be sent to the targetid
    SendClientMessage(targetid, -1, string);//Sends the message that is formatted above to the targetid in a random color
    pData[targetid][Faction] == 0; //Sets their faction variable to 0 (civilian)
    pData[targetid][Rank] == 0; //Sets their rank variable to 0 (no rank)
    return 1; //Returns a value
} //Closed bracket
CMD:setrank(playerid, params[])
{
    new targetid, rank, targetname[24], playername[24], string[128]; //Creates our variable
    if(sscanf(params, "ui", targetid, rank)) return SendClientMessage(playerid, -1, "Usage: /setrank [playerid/partofname][rank]"); //Sends correct usage if they do not type in the rank and playerid
    if(pData[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(pData[targetid][Faction] != pData[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(0 < 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(playerid, playername, sizeof(playername)); //Stores the playerid's name into the playername variable
        GetPlayerName(targetid, targetname, sizeof(targetname)); //Stores the targetid's name into the targetname variable
        if(pData[targetid][Rank] < rank) //If the players rank is less than the rank being given (promotion)
        { //Open bracket
            format(string, sizeof(string), "You have been promoted to rank %i by %s!", rank, playername); //Formats the message for the targetid
            SendClientMessage(targetid, -1, string); //Sends formatted message to targetid
            format(string, sizeof(string), "You promoted %s to rank %i", targetname, rank); //Formats the message for the playerid
            SendClientMessage(playerid, -1, string); //Sends formatted message to playerid
        } //Closed bracket
        else //Else (demotion)
        { //Open bracket
            format(string, sizeof(string), "You have been demoted to rank %i by %s!", rank, playername); //Same as above
            SendClientMessage(targetid, -1, string); //Same as above
            format(string, sizeof(string), "You demoted %s to rank %i", targetname, rank); //Same as above
            SendClientMessage(playerid, -1, string); //Same as above
        } //Closed bracket
    } //Closed bracket
    return 1; //Return a value
}
Reply
#2

Do you expect us to know which line the errors are on..?
Reply
#3

Dis commands don't work
/setrank work but the other's don't work.
Код:
CMD:makeleader(playerid, params[])
{
    if (APlayerData[playerid][PlayerLevel] >= 7)
    new targetid, factionid, string[128], targetname[24], playername[24];
    if(sscanf(params, "ui", targetid, factionid)) 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(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "Invalid playerid!"); //Sends a message if the player is not connected
    if(0 < 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(playerid, playername, sizeof(playername)); //Gets the players name and saves it to the variable playername
        GetPlayerName(targetid, targetname, sizeof(targetname)); //Gets the targets name and saves it to the variable targetname
        format(string, sizeof(string), "You made %s leader of faction id %i!", targetname, factionid); //Formats the string that you will receive
        SendClientMessage(playerid, -1, string); //Sends a message to the person who changes the other persons faction in a random color
        format(string, sizeof(string), "You were made leader of faction id %i by %s", factionid, playername);//Formats the string that the player will receive
        SendClientMessage(playerid, -1, string); //Sends a message to the person who is made the faction leader
        pData[playerid][Faction] == factionid;
        pData[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 factionid.  Factionid'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(playerid, params[]) //Format to create a command
{ //Open bracket
    new targetid, targetname[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(pData[playerid][Rank] != 6) return SendClientMessage(playerid, -1, "You are not the leader of a faction!");
    GetPlayerName(targetid, targetname, sizeof(targetname)); //Stores the targetid's name in the targetname variable
    GetPlayerName(playerid, playername, sizeof(playername)); //Stores the playerid's name in the playername variable
    format(string, sizeof(string), "You removed %s from his (now) previous faction!", targetname);//Formats the message that will be sent to you (the player)
    SendClientMessage(playerid, -1, string);//Sends the message that is formatted above to the playerid in a random color
    format(string, sizeof(string), "You were removed from your faction by %s!", playername);//Formats the message that will be sent to the targetid
    SendClientMessage(targetid, -1, string);//Sends the message that is formatted above to the targetid in a random color
    pData[targetid][Faction] == 0; //Sets their faction variable to 0 (civilian)
    pData[targetid][Rank] == 0; //Sets their rank variable to 0 (no rank)
    return 1; //Returns a value
} //Closed bracket
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)