bike system. -
Karolukas123 - 18.08.2015
hey so.. i dont know how to fix it..
first i use dialog to create bike:
Код:
new Engine, Lights, Alarm, Doors, Bonnet, Boot, Objective;
CreateVehicle(510, -324.7136,1079.9130,19.7422,274.5824, -1, -1, 60);
GetVehicleParamsEx(510, Engine, Lights, Alarm, Doors, Bonnet, Boot, Objective);
SetVehicleParamsEx(510, true, false, Alarm, Doors, Bonnet, Boot, Objective);
PutPlayerInVehicle(playerid, 510, 0);
SendClientMessage(playerid, -1, "• Test Message");
GivePlayerMoneyA(playerid, -100);
Later i use timer to check if server can destroy bike but server dont destroy it...
Код:
SetTimer("DestroyBikes", 60000, false);
}
forward DestroyBikes(playerid);
public DestroyBikes(playerid)
{
DestroyVehicle(510);
return 1;
Re: bike system. -
Dairyll - 18.08.2015
GetVehicleParamsEx
SetVehicleParamsEx
PutPlayerInVehicle
DestroyVehicle
They're all trying to call on the Vehicle ID 510, not the bike you just created. 510 is the model ID of the bike. You have to get the vehicle's actual ID for those four to work properly.
Re: bike system. -
Denying - 18.08.2015
What you are doing is try and destroy the vehicle model, you need the vehicle's ID.
put this before CreateVehicle
new vehID = CreateVehicle(...);
Also with GetVehicleParamsEx, instead of 510, use vehID.
Then when you set the timer, you will want to use SetTimerEx, most likely, since you're trying to pass on a player id.
So instead of SetTimer("DestroyBikes", 60000, false); .. wait, you want to destroy all bikes? That would require looping through all vehicles, checking for their model and then destroying.
So don't change your timer but change your forward and public to
Код:
forward DestroyBikes();
public DestroyBikes()
{
for(new i = 0; i < MAX_VEHICLES; i++)
{
if(GetVehicleModel(i) == 510)
DestroyVehicle(i);
}
return 1;
}
I believe MAX_VEHICLES is defined by default like MAX_PLAYERS, but if you get an error, just define it yourself using
#define MAX_VEHICLES [num]
Re: bike system. -
Karolukas123 - 18.08.2015
So if i create.
p.s NO, i need for player id create and destroy not all.. if i create so my bike destroy not all players
Код:
new Bikes[MAX_PLAYERS];
Bikes[playerid] = CreateVehicle(510, -324.7136,1079.9130,19.7422,274.5824, -1, -1, 60);
and later use that Bikes[playerid] ?
Re: bike system. -
SickAttack - 18.08.2015
If it is player-oriented (one dynamic bike for each player), then yes.
Re: bike system. -
Denying - 18.08.2015
Bikes[playerid] will hold the ID of the bike that was created for that player.
Then you'll need to use:
SetTimerEx("DestroyBikes", 60000, false, "i", playerid);
and then in your public use
Код:
public DestroyBikes(playerid)
{
DestroyVehicle(Bikes[playerid]);
return 1;
}