Help me with these errors please. -
xIs0BiHx - 25.02.2017
../gamemodes/Build.pwn(12940) : error 029: invalid expression, assumed zero
../gamemodes/Build.pwn(12940) : error 017: undefined symbol "i"
../gamemodes/Build.pwn(12941) : warning 209: function "CreateLoot" should return a value
../gamemodes/Build.pwn(12942) : error 010: invalid function or declaration
../gamemodes/Build.pwn(12950) : error 010: invalid function or declaration
PHP код:
public CreateLoot(itemid1, itemid2, itemid3, itemid4, Float:X, Float:Y, Float:Z, worldid, intid)
{
new found = 0, foundid = 0, str[128];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(LootInfo[i][lUsed] == 0 && found == 0)
{
found++;
foundid=i;
}
}
if(found == 0) return true;
LootInfo[foundid][lUsed]=1;
LootInfo[foundid][lText]=CreateDynamic3DTextLabel(str, 0x33AA33FF, X, Y, Z-0.7, 25.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, worldid, intid, -1, 50.0);
if(itemid1 > 21 && itemid1 < 35)
{
LootInfo[foundid][lObject] = CreateDynamicObject(PrintIid(itemid1), X, Y, Z - 1, 80.0, 0.0, 0.0, worldid);
}
if(itemid1 >= 100 && itemid1 <= 150)
{
LootInfo[foundid][lObject] = CreateDynamicObject(2037, X, Y, Z - 1, 0.0, 0.0, 0.0, worldid);
}
if(itemid1 == 403)
{
LootInfo[foundid][lObject] = CreateDynamicObject(1650, X, Y, Z - 1, 0.0, 0.0, 0.0, worldid);
}
if(itemid1 == 406)
{
LootInfo[foundid][lObject] = CreateDynamicObject(1210, X, Y, Z - 1, 0.0, 0.0, 0.0, worldid);
}
if(itemid1 >= 500 && itemid1 <= 550) = ShowPlayerDialog(i, DIALOG_PACKAGE, DIALOG_STYLE_LIST, string, "Shoe Box\nTrash Bag\nLunch Bag\nRubbish Box\nBurger Box\nDefault Drug Package", "Drop", "Cancel");
}
LootInfo[foundid][lTime]=60;
LootInfo[foundid][lItem][0]=itemid1;
LootInfo[foundid][lItem][1]=itemid2;
LootInfo[foundid][lItem][2]=itemid3;
LootInfo[foundid][lItem][3]=itemid4;
LootInfo[foundid][lX]=X;
LootInfo[foundid][lY]=Y;
LootInfo[foundid][lZ]=Z;
return true;
}
I want a dialog to show up here, been playing around with it for 4 hours but can't seem to get success...
PHP код:
if(itemid1 >= 500 && itemid1 <= 550) = ShowPlayerDialog(i, DIALOG_PACKAGE, DIALOG_STYLE_LIST, string, "Shoe Box\nTrash Bag\nLunch Bag\nRubbish Box\nBurger Box\nDefault Drug Package", "Drop", "Cancel");
Re: Help me with these errors please. -
Hansrutger - 25.02.2017
Replace "i" with "foundid" instead. Remove the equal sign before the ShowPlayerDialog and delete the }-bracket after the ShowPlayerDialog.
Honestly I haven't read through it fully (which means that the code will perhaps not work as intended) but you have to look at these small mistakes yourself, they get easier to spot by time but just read what the errors say and you should be fine. Cheers
Re: Help me with these errors please. -
xIs0BiHx - 25.02.2017
Thanks for the reply, I'll try it out.
Re: Help me with these errors please. -
xIs0BiHx - 25.02.2017
It's compiling, but crashing when I drop a drug.
It should work like this, if I drop itemid 500-550 (ID's for the drugs) a dialog should come up, it shouldn't just drop a object like the other itemid's do, in that dialog I can select how the dropped object should look like, that would be a Shoe Box etc. to conceal the drug and make it not too obvious when dropping it off somewhere.
I had it working before but now the whole dialog thing messed up.
Re: Help me with these errors please. -
AjaxM - 25.02.2017
Try this.
PHP код:
public CreateLoot(itemid1, itemid2, itemid3, itemid4, Float:X, Float:Y, Float:Z, worldid, intid)
{
new found = 0, foundid = 0, str[128];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(LootInfo[i][lUsed] == 0 && found == 0)
{
found++;
foundid=i;
}
}
if(found == 0) return true;
LootInfo[foundid][lUsed]=1;
LootInfo[foundid][lText]=CreateDynamic3DTextLabel(str, 0x33AA33FF, X, Y, Z-0.7, 25.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, worldid, intid, -1, 50.0);
if(itemid1 > 21 && itemid1 < 35)
{
LootInfo[foundid][lObject] = CreateDynamicObject(PrintIid(itemid1), X, Y, Z - 1, 80.0, 0.0, 0.0, worldid);
}
if(itemid1 >= 100 && itemid1 <= 150)
{
LootInfo[foundid][lObject] = CreateDynamicObject(2037, X, Y, Z - 1, 0.0, 0.0, 0.0, worldid);
}
if(itemid1 == 403)
{
LootInfo[foundid][lObject] = CreateDynamicObject(1650, X, Y, Z - 1, 0.0, 0.0, 0.0, worldid);
}
if(itemid1 == 406)
{
LootInfo[foundid][lObject] = CreateDynamicObject(1210, X, Y, Z - 1, 0.0, 0.0, 0.0, worldid);
}
if(itemid1 >= 500 && itemid1 <= 550){
ShowPlayerDialog(i, DIALOG_PACKAGE, DIALOG_STYLE_LIST, string, "Shoe Box\nTrash Bag\nLunch Bag\nRubbish Box\nBurger Box\nDefault Drug Package", "Drop", "Cancel");}
LootInfo[foundid][lTime]=60;
LootInfo[foundid][lItem][0]=itemid1;
LootInfo[foundid][lItem][1]=itemid2;
LootInfo[foundid][lItem][2]=itemid3;
LootInfo[foundid][lItem][3]=itemid4;
LootInfo[foundid][lX]=X;
LootInfo[foundid][lY]=Y;
LootInfo[foundid][lZ]=Z;
return true;
}
P.S: Don't forget to do what Hansrugter said in the script i gave you!