Pawno Errors
#1

Hello. I have a problem in pawn. I wanted to make a factions system, and i red some tutorials, but when I try to complie it gives me these errors:
Код:
 C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(77) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(79) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(81) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(83) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(85) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(91) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(92) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(94) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(95) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(97) : error 021: symbol already defined: "GetPlayerName"
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(102) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(105) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(106) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(111) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(130) : warning 203: symbol is never used: "makeleader"
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(130) : warning 203: symbol is never used: "removefromfaction"
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(130) : warning 203: symbol is never used: "setrank"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


14 Errors.
My lines are:
pawn Код:
#include <a_samp>

enum PlayerData //We create an enumerator entitled "PlayerData"
{ //Open bracket
    Faction, //This is the variable we are going to store our faction id in.
    Rank //The variable that we store the faction rank in.
}; //Close bracket and semi-colon to finish the enumerator
new pData[MAX_PLAYERS][PlayerData]; //We create a variable that stores our enumerator info for each player.

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(AdminVariable[playerid] != 6 && 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
}

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) //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

//Place where you want to save it
dini_IntSet(File,"Factionid",pData[playerid][Faction]); //Saving using dini
dini_IntSet(File,"Rank", pData[playerid][Rank]); //Saving using dini

INI_WriteInt(File, "Factionid", pData[playerid][Faction]); //Saving using y_ini
INI_WriteInt(File, "Rank", pData[playerid][Rank]); //Saving using y_ini

GetPlayerName(playerid, playername, sizeof(playername)); //You still have to create the variable playername
format(string, sizeof(string), "UPDATE `table` SET factionid = %i, rank = %i WHERE Username = %s", pData[playerid][Faction], pData[playerid][Rank], playername); //Updating mysql database with facitonid/rank
mysql_query(string); //Sending the query.  Remember, must still create the variable "string"

//Place where you want to load it
pData[playerid][Faction] = dini_Get(File, "Factionid"); //Loading using dini
pData[playerid][Rank] = dini_Get(File, "Rank"); //Loading using dini

INI_Int("Factionid",pData[playerid][Faction]);
INI_Int("Rank",pData[playerid][Rank]);

//Not going to show loading for mysql, this is a pain to create from scratch right now, and it is boring.

new LSPDVehicles[11];
LVPDVehicles[0] = AddStaticVehicle(265,2269.2725,2441.8655,10.8203,359.7333,0,0,0,0,0,0);
LVPDVehicles[1] = AddStaticVehicle(265,2260.4592,2441.9963,10.8203,2.2634,0,0,0,0,0,0);
LVPDVehicles[2] = AddStaticVehicle(265,2256.1191,2442.6707,10.8203,355.9967,0,0,0,0,0,0);

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    for(new i = 0; i < 12; i++) //Loop.  It counts to 11
    { //Open Bracket
        if(vehicleid == LSPDVehicles[i]) //If the vehicleid is an LSPD vehicle
        { //Open Bracket
            if(pData[playerid][Faction] != 1) //If the player is not in faction 1 (LSPD, in this case)
            { //Open Bracket
                ClearAnimations(playerid); //Clears their animation, preventing them from entering the vehicle.
                SendClientMessage(playerid, -1, "You don`t have the keys for this car."); //Sends a message to the player that he cannot enter it.
            } //Closed Bracket
        } //Closed Bracket
    } //Closed Bracket
    return 1; //Return a value
}
Can someone please help me ?
Reply
#2

is this everything? i am certain this is not everything..... iz all confusing...u don't have zcmd included sscanf2 included and u have random things all overs like the addstaticvehicle
Reply
#3

Can you please highlight the lines which give the errors?
Reply
#4

Quote:
Originally Posted by Glad2BeHere
Посмотреть сообщение
is this everything? i am certain this is not everything..... iz all confusing...u don't have zcmd included sscanf2 included and u have random things all overs like the addstaticvehicle
Thank you for tellin' me now i have less errors. They're 4 I tried to fix one of them but it still don't work see:

Код:
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(17) : error 017: undefined symbol "AdminVariable"
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(17) : warning 215: expression has no effect
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(17) : error 001: expected token: ";", but found "]"
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(17) : error 029: invalid expression, assumed zero
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(17) : fatal error 107: too many error messages on one line

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


4 Errors.
Reply
#5

add this ontop
pawn Код:
new AdminVariable[MAX_PLAYERS]; //right below #include
Reply
#6

Quote:
Originally Posted by Glad2BeHere
Посмотреть сообщение
add this ontop
pawn Код:
new AdminVariable[MAX_PLAYERS]; //right below #include
This is not helping much
Код:
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(29) : warning 215: expression has no effect
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(30) : warning 215: expression has no effect
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(48) : warning 215: expression has no effect
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(49) : warning 215: expression has no effect
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(82) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(84) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(86) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(88) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(90) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(96) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(97) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(99) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(100) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(102) : error 021: symbol already defined: "GetPlayerName"
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(107) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(110) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(111) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(116) : error 010: invalid function or declaration
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(122) : error 017: undefined symbol "LSPDVehicles"
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(122) : warning 215: expression has no effect
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(122) : error 001: expected token: ";", but found "]"
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(122) : error 029: invalid expression, assumed zero
C:\Users\User\Desktop\New folder\filterscripts\testveh.pwn(122) : fatal error 107: too many error messages on one line

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


18 Errors.
Reply
#7

Copy everything and paste it to her.... and post back the link here HEREEEEEEEEEEEEEEEEEEEE
Reply
#8

Quote:
Originally Posted by Glad2BeHere
Посмотреть сообщение
Copy everything and paste it to her.... and post back the link here HEREEEEEEEEEEEEEEEEEEEE
Click me
Reply
#9

Oh Cool Story Bro if thats is the entire script (facepalm) u need to learn how to script cuz that isn't a script.... that things place in random places......... read up on functions learn how 2 use call backs and variables with callbacks..... cuz that just words on paper u got there .... hope i didn't sound like an ass
Reply
#10

change AdminVariable to the variable you use on your script.

You are putting weird codes at the middle of the script!

mhm
where did you put this? at the middle of the script ( not in a callback or what )?
pawn Код:
f(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) //If the faction is 1 and the rank is 6
The code above is just an example to check player's faction thingy! Not to put in the middle of the script like that!

if you put it randomly at the script, you did a wrong thing
and make sure you put this at ongamemodeinit, not in the middle of the script
pawn Код:
// top of script
new LSPDVehicles[11];

// gamemodeinit
LVPDVehicles[0] = AddStaticVehicle(265,2269.2725,2441.8655,10.8203,359.7333,0,0,0,0,0,0);
LVPDVehicles[1] = AddStaticVehicle(265,2260.4592,2441.9963,10.8203,2.2634,0,0,0,0,0,0);
LVPDVehicles[2] = AddStaticVehicle(265,2256.1191,2442.6707,10.8203,355.9967,0,0,0,0,0,0);
You are putting this at the middle of the script
pawn Код:
dini_IntSet(File,"Factionid",pData[playerid][Faction]); //Saving using dini
dini_IntSet(File,"Rank", pData[playerid][Rank]); //Saving using dini

INI_WriteInt(File, "Factionid", pData[playerid][Faction]); //Saving using y_ini
INI_WriteInt(File, "Rank", pData[playerid][Rank]); //Saving using y_ini
Put it at the place where your player registers
And, pick one which you use, do you use dini or y_ini?

Put these lines below on log-in, and choose what you use, dini or y_ini?
pawn Код:
pData[playerid][Faction] = dini_Get(File, "Factionid"); //Loading using dini
pData[playerid][Rank] = dini_Get(File, "Rank"); //Loading using dini

INI_Int("Factionid",pData[playerid][Faction]);
INI_Int("Rank",pData[playerid][Rank]);
Don't put random lines in the middle of the script if you don't even know what it will do.
Not being rude, but all you do was to copy paste all things without even editing the script.


Like :
When you put ( note that the code below is just a random piece of code )
pawn Код:
if(playerid==pro)
at the middle of the script (not in a callback), it will send an error, where is playerid? it's not defined there
pawn Код:
public OnPlayerConnect(playerid)
{
    if(playerid==pro)
    { //codes here
    }
    return 1;
}
Now that will work, as there is "playerid" at OnPlayerConnect
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)