"Undefined symbol "bagid" "
#1

Hi.

I'm creating a Drugs system.
This drug system allows to drop bags containing drugs.

I've defined MAX_BAGS, i've done my enum bContenu (French word, sry), and I also have created my bagContains array, but nothing.
When I compile, "Undefined symbol "bagid" "

Look at my code

PHP код:

#define MAX_BAGS 600
enum bContenu
{
    
Railsv,
    
Poudre,
    
Poudrep,
    
Feuilles,
    
Graines,
    
Weed,
    
Rails,
    
Joints,
};
new 
bagContains[MAX_BAGS][bContenu];
// in OnPlayerDeath
            
new ramm random(150);
        new 
pamm random(300);
        new 
ppamm random(50);
        new 
famm random(100);
        new 
wamm random(150);
        new 
gamm random(300);
        new 
camm random(50);
        new 
jamm random(50);
        new 
total ramm+pamm+ppamm+famm+wamm+gamm+camm+jamm;
        
PlayerInfo[playerid][pRailsv] -= ramm;
        
PlayerInfo[playerid][pPoudre] -= pamm;
        
PlayerInfo[playerid][pPoudrep] -= ppamm;
        
PlayerInfo[playerid][pWeed] -= wamm;
        
PlayerInfo[playerid][pFeuilles] -= famm;
        
PlayerInfo[playerid][pGraines] -= gamm;
        
PlayerInfo[playerid][pRails] -= camm;
        
PlayerInfo[playerid][pJoints] -= jamm;
        
format(stringsizeof(string), "{9ACD32}[Information]{FFFFFF} A ta mort, tu as perdu %d graines, %d feuilles de weed, %d feuilles а rouler, %d rails vides, %d grammes de poudre а prйparer, %d grammes de poudre prйparйe, %d joints et %d rails de coke prйparйs."gammwammfammrammpammppammjammcamm);
        
SendClientMessage(playerid, -1string);
        
GetPlayerPos(playeridxyz);
        
SpawnBag(2919xyz0.0);
        
bagContains[bagid][Railsv] = ramm;
        
bagContains[bagid][Poudre] = pamm;
        
bagContains[bagid][Poudrep] = ppamm;
        
bagContains[bagid][Weed] = wamm;
        
bagContains[bagid][Feuilles] = famm;
        
bagContains[bagid][Graines] = gamm;
        
bagContains[bagid][Rails] = camm;
        
bagContains[bagid][Joints] = jamm
Anyone has an idea about the undefined symbol ?

Thanks in advance
Reply
#2

Undefined symbol means that u havent defined the symbol anywhere.
Reply
#3

I know it

But MAX_BAGS should work like MAX_PLAYERS no ?
So bagid is the same as playerid, but for the bags, and it not depends of players, but of bags, isn't ?

I just ask questions, I don't know how to solve this problem, and how does it was created :3
Reply
#4

You whole code is completely.... terribly.... wrong.How can you carry out operations outside a function block?You need to first put those assignments and format,etc inside a function block where it can get executed.

Does that in...OnPlayerDeath mean its inside the callback { }??Or that's a comment in your code?
Reply
#5

Quote:
Originally Posted by Yashas
Посмотреть сообщение
You whole code is completely.... terribly.... wrong.How can you carry out operations outside a function block?You need to first put those assignments and format,etc inside a function block where it can get executed.

Does that in...OnPlayerDeath mean its inside the callback { }??Or that's a comment in your code?
His question is about why 'bagid' isn't working, nothing else.

Quote:
Originally Posted by S4t3K
Посмотреть сообщение
I know it

But MAX_BAGS should work like MAX_PLAYERS no ?
So bagid is the same as playerid, but for the bags, and it not depends of players, but of bags, isn't ?

I just ask questions, I don't know how to solve this problem, and how does it was created :3
Let me explain why 'bagid' isn't and 'playerid' is working;
'bagid' isn't working because you do not have any variable named 'bagid' holding any value (The bagid), you should code it so you'll have a function which gets the bagid you need or something, then you COULD do
pawn Код:
#define bagid return GetBagID();
and then you could use 'bagid' as you are doing, currently it just doesn't exist. You could more easily do this;
pawn Код:
new bagid = -1;
*code to get the bagid you need*
*use bagid where ever you want (As long as the variable is in the same function/callback/whatsoever)*
To get back to the point, the reason why 'playerid' is working is because when the command, or where ever you are using the playerid should have 'playerid' as argument, for example
pawn Код:
OnPlayerCommandText(playerid, cmdtext[])
{
// code
}

or ZCMD:

CMD:command(playerid, params[])
{
// code
}
You see how they both have 'playerid' as argument? Now well, that's the reason why you don't have to get the playerid yourself, the explanation is quite messy (And pobably also shit, lol) but I have no clue how to explain it better!

Best regards,
Jesse
Reply
#6

More information please.
Reply
#7

This is what you need:

pawn Код:
for(new i; i < MAX_BAGS; i++)
{
    if(!bagContains[i][InUse])
    {
        bagContains[i][InUse] = 1;
        bagContains[i][Railsv] = ramm;
        bagContains[i][Poudre] = pamm;
        bagContains[i][Poudrep] = ppamm;
        bagContains[bagid][Weed] = wamm;
        bagContains[i][Feuilles] = famm;
        bagContains[i][Graines] = gamm;
        bagContains[i][Rails] = camm;
        bagContains[i][Joints] = jamm;
        break;
    }
}
Just add InUse to your enum and reset [InUse] to 0 once bag is picked up, also you made a random , but you dont even check, if player really has such amount and you take it off, what if I have 1 Rails, but random gives me 80 ? I wll get -79 Rails on my stats.
Reply
#8

Sorry, in France, it's 6:30pm :3

iKey, this is right.
I'll correct it right now.

But for your system "in use", I want to make the bag as, even if a bag isn't picked up yet, and if the player dies again, it makes a new bag.
No bag limit, except MAX_BAGS.

And I want to make the bag as pickupable by another player than the death one.
So how may I do ? :3
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)