Posts: 617
Threads: 129
Joined: Feb 2014
Ok i want to make an car export system but here is the problem i want it so a random car is spawned at a random area and you got to take it to the checkpoint to sell it, i need to know how to check if thats the same car when entered the checkpoint and it wont respawn again at the same position ,and on the map i want the car to have a icon... Could someone help me what wll i need to create are show me an example are a link to a tutorial cause i cant find any..
Another issue
Im useing the famous moneybag filterscript but it have a bugg where if a player pickup any pickup the player receives the money in the moneybag.
pawn Код:
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);
}
Posts: 617
Threads: 129
Joined: Feb 2014
Quote:
Originally Posted by Aly
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);
And to check if that's the same care that you spawned you can save its ID into a variable, like SpawnVeh = vehicleid; or if you want to spawn multiple vehicles you can make an array: new SpawnVeh[2]; SpawnVeh[0] = vehicleid; .And when he enters the CP you just check: if(GetPlayerVehicleID(playerid) == SpawnVeh) ...
|
And aly what if i dont spawn a car i just use a random server car and tell them to take it to the export area... So how will i make it so that it chooses a random car from the server every 1hr to be exported...Btw i understand the rest just need to get how to choose the random car clear
Quote:
Originally Posted by Vince123
This is the thing causing you the error. Try removing it, and see.
|
Vince im sorry man that didnt work
Posts: 617
Threads: 129
Joined: Feb 2014
Quote:
Originally Posted by Aly
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.
And about Moneybag answer my question,When is the pickup "MoneyBagPickup" created?
|
pawn Код:
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;
}
Posts: 219
Threads: 0
Joined: Oct 2012
Reputation:
0
When is the function MoneyBag getting called?
Because on what I see here after somebody found the bag another bag will be spawned next time the function MoneyBag is being called