if(pickupid == MoneyBagPickup)
{
new string[180], pname[24], money = MoneyBagCash;
GetPlayerName(playerid, pname, 24);
format(string, sizeof(string), "** {99FFFF}%s{FFFFFF} has found the {33FF66}money bag{FFFFFF} that had {33FF00}$%d {FFFFFF}inside, located in %s", pname, money, MoneyBagLocation);
MoneyBagFound = 1;
SendClientMessageToAll(-1, string);
DestroyPickup(MoneyBagPickup);
SendClientMessage(playerid, -1, "You have found the {33FF66} Money Bag!");
GivePlayerMoney(playerid, money);
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
}
native STREAMER_TAG_MAP_ICON CreateDynamicMapIcon(Float:x, Float:y, Float:z, type, color, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = STREAMER_MAP_ICON_SD, style = MAPICON_LOCAL); native DestroyDynamicMapIcon(STREAMER_TAG_MAP_ICON iconid); native IsValidDynamicMapIcon(STREAMER_TAG_MAP_ICON iconid);
GivePlayerMoney(playerid, money); |
When is the pickup "MoneyBagPickup" created?
As for the car export system, here are some function from Incognito's streamer to help you with your map icon: Код:
native STREAMER_TAG_MAP_ICON CreateDynamicMapIcon(Float:x, Float:y, Float:z, type, color, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = STREAMER_MAP_ICON_SD, style = MAPICON_LOCAL); native DestroyDynamicMapIcon(STREAMER_TAG_MAP_ICON iconid); native IsValidDynamicMapIcon(STREAMER_TAG_MAP_ICON iconid); |
This is the thing causing you the error. Try removing it, and see.
|
new cars; for(new i=0;i<MAX_VEHICLES;i++) { if(!IsValidVehicle(i)) //Check if the vehicle is not created. { cars = i-1; //It stores the last created vehicle ID; break; } } new SpawnVeh = random(cars); //It selects a random car.
You can make a loop to check how many cars you have on server then random that value, something like this:
Код:
new cars; for(new i=0;i<MAX_VEHICLES;i++) { if(!IsValidVehicle(i)) //Check if the vehicle is not created. { cars = i-1; //It stores the last created vehicle ID; break; } } new SpawnVeh = random(cars); //It selects a random car. |
forward MoneyBag();
public MoneyBag()
{
new string[175];
if(!MoneyBagFound)
{
format(string, sizeof(string), "**The {33FF66} Money bag {FFFFFF}has {FF0000} not {FFFFFF} been found, it is still hidden in {FFFF66} %s", MoneyBagLocation);
SendClientMessageToAll(-1, string);
}
else if(MoneyBagFound)
{
MoneyBagFound = 0;
new randombag = random(sizeof(MBSPAWN));
MoneyBagPos[0] = MBSPAWN[randombag][XPOS];
MoneyBagPos[1] = MBSPAWN[randombag][YPOS];
MoneyBagPos[2] = MBSPAWN[randombag][ZPOS];
format(MoneyBagLocation, sizeof(MoneyBagLocation), "%s", MBSPAWN[randombag][Position]);
format(string, sizeof(string), "**The {33FF66}Money Bag has been {FF0000} hidden in {FFFF66} %s!", MoneyBagLocation);
SendClientMessageToAll(-1, string);
MoneyBagPickup = CreatePickup(1550, 2, MoneyBagPos[0], MoneyBagPos[1], MoneyBagPos[2], -1);
}
return 1;
}