#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(string, sizeof(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.", gamm, wamm, famm, ramm, pamm, ppamm, jamm, camm);
SendClientMessage(playerid, -1, string);
GetPlayerPos(playerid, x, y, z);
SpawnBag(2919, x, y, z, 0.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;

|
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? |
|
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 |
#define bagid return GetBagID();
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)*
OnPlayerCommandText(playerid, cmdtext[])
{
// code
}
or ZCMD:
CMD:command(playerid, params[])
{
// code
}
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;
}
}