Errors.
#1

I have no idea how to fix it, Anyone please help..

pawn Код:
C:\Users\Acer\Desktop\All files\base rp gm\gamemodes\RP.pwn(155) : error 017: undefined symbol "PlayerData"
C:\Users\Acer\Desktop\All files\base rp gm\gamemodes\RP.pwn(155) : error 009: invalid array size (negative, zero or out of bounds)
C:\Users\Acer\Desktop\All files\base rp gm\gamemodes\RP.pwn(1235) : warning 215: expression has no effect
C:\Users\Acer\Desktop\All files\base rp gm\gamemodes\RP.pwn(1236) : warning 215: expression has no effect
C:\Users\Acer\Desktop\All files\base rp gm\gamemodes\RP.pwn(1247) : error 029: invalid expression, assumed zero
C:\Users\Acer\Desktop\All files\base rp gm\gamemodes\RP.pwn(1247) : warning 215: expression has no effect
C:\Users\Acer\Desktop\All files\base rp gm\gamemodes\RP.pwn(1247) : error 001: expected token: ";", but found ")"
C:\Users\Acer\Desktop\All files\base rp gm\gamemodes\RP.pwn(1247) : error 029: invalid expression, assumed zero
C:\Users\Acer\Desktop\All files\base rp gm\gamemodes\RP.pwn(1247) : fatal error 107: too many error messages on one line
pawn Код:
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(!IsPlayerAdmin(playerid)) 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.
}
pawn Код:
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(!IsPlayerAdmin(playerid)) && 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
pawn Код:
new pData[MAX_PLAYERS][PlayerData];
Reply
#2

Do you have a enum at the top?If yes show us.
Reply
#3

Yes..
Here are they
pawn Код:
enum pInfo
{
    Password,
    Cash,
    Level,
    Kills,
    Faction,
    Rank,
    Deaths,
    Adminlevel
};
Reply
#4

try changing this
PHP код:
new pData[MAX_PLAYERS][PlayerData]; 
to
PHP код:
new pData[MAX_PLAYERS][pInfo]; 
Reply
#5

pawn Код:
C:\Users\Acer\Desktop\All files\base rp gm\gamemodes\RP.pwn(1234) : warning 215: expression has no effect
C:\Users\Acer\Desktop\All files\base rp gm\gamemodes\RP.pwn(1235) : warning 215: expression has no effect
C:\Users\Acer\Desktop\All files\base rp gm\gamemodes\RP.pwn(1246) : error 029: invalid expression, assumed zero
C:\Users\Acer\Desktop\All files\base rp gm\gamemodes\RP.pwn(1246) : warning 215: expression has no effect
C:\Users\Acer\Desktop\All files\base rp gm\gamemodes\RP.pwn(1246) : error 001: expected token: ";", but found ")"
C:\Users\Acer\Desktop\All files\base rp gm\gamemodes\RP.pwn(1246) : error 029: invalid expression, assumed zero
C:\Users\Acer\Desktop\All files\base rp gm\gamemodes\RP.pwn(1246) : fatal error 107: too many error messages on one line
New errors.. Line no 1246 is
pawn Код:
if(!IsPlayerAdmin(playerid)) && pData[playerid][Rank] != 6) return SendClientMessage(playerid, -1, "You are not a high enough admin or you aren't the leader!");
and no 1234 and 1235.
pawn Код:
pData[playerid][Faction] == factionid;
        pData[playerid][Rank] == 6;
Reply
#6

Код:
if(!IsPlayerAdmin(playerid) && pData[playerid][Rank] != 6) return SendClientMessage(playerid, -1, "You are not a high enough admin or you aren't the leader!");
Код:
pData[playerid][Faction] = factionid;
        pData[playerid][Rank] = 6;
Reply
#7

PHP код:
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(!IsPlayerAdmin(playerid) && 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(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
    
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

PHP код:
 pData[playerid][Faction] = factionid;
        
pData[playerid][Rank] = 6
Try this.
Reply
#8

pawn Код:
C:\Users\Acer\Desktop\All files\base rp gm\gamemodes\RP.pwn(2531) : error 010: invalid function or declaration
C:\Users\Acer\Desktop\All files\base rp gm\gamemodes\RP.pwn(2533) : error 010: invalid function or declaration
C:\Users\Acer\Desktop\All files\base rp gm\gamemodes\RP.pwn(2535) : error 010: invalid function or declaration
C:\Users\Acer\Desktop\All files\base rp gm\gamemodes\RP.pwn(2537) : error 010: invalid function or declaration
C:\Users\Acer\Desktop\All files\base rp gm\gamemodes\RP.pwn(2539) : error 010: invalid function or declaration
.
Here are the lines starting from 25-..
pawn Код:
if(pData[playerid][Faction] == 1) //If the faction is 1

if(pData[playerid][Faction] == 1 || pData[playerid][Faction] == 2) //Checks if it is faction 1 or 2

if(0 < pData[playerid][Faction] < 3) //Checks if it is between 0 and 3

if(pData[playerid][Faction] != 0) //If the faction is not 0

if(pData[playerid][Faction] == 1 && pData[playerid][Rank] == 6)
Reply
#9

PHP код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#if defined FILTERSCRIPT

#endif
enum pInfo
{
    
Password,
    
Cash,
    
Level,
    
Kills,
    
Faction,
    
Rank,
    
Deaths,
    
Adminlevel
};
new 
pData[MAX_PLAYERS][pInfo];

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(!IsPlayerAdmin(playerid)) 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(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
        
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(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(!IsPlayerAdmin(playerid) && 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(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
    
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

Your full script,this does not give any error or warning to me.
Reply
#10

Edited : I removed those lines and it Compiled, ty all.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)