Destroy vehicle on TimerEX -
boelie - 01.07.2009
I desperatly need a timer to destroy objects and/or vehicles
Today i tried it, i wanted to destroy a vehicle on a timer.
destroyvehicle didnt worked..so i tried it with createexplosion..well that worked but i
still cant figure out why destroyobject didnt work.
Maybe someone can explain ?
i got this now;
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
{
new vehiclemod = GetVehicleModel (GetPlayerVehicleID(playerid));
if(vehiclemod == 432 )
SetTimerEx("explosion", 20000, false, "20");
DestroyVehicle(432);
}
return 1;
}
This code worked with the explosions though and i did the define andpublic thing ofcourse
Re: Destroy vehicle on TimerEX -
dice7 - 01.07.2009
You need the vehicle id in DestroyVehicle, not model
Re: Destroy vehicle on TimerEX -
boelie - 01.07.2009
Quote:
Originally Posted by dice7
You need the vehicle id in DestroyVehicle, not model
|
LOL omg! well...ill change that tommorow
sleepy time now thnx (again)
Re: Destroy vehicle on TimerEX -
Moustafa - 01.07.2009
Quote:
Originally Posted by boelie
I desperatly need a timer to destroy objects and/or vehicles
Today i tried it, i wanted to destroy a vehicle on a timer.
destroyvehicle didnt worked..so i tried it with createexplosion..well that worked but i
still cant figure out why destroyobject didnt work.
Maybe someone can explain ?
i got this now;
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
{
new vehiclemod = GetVehicleModel (GetPlayerVehicleID(playerid));
if(vehiclemod == 432 )
SetTimerEx("explosion", 20000, false, "20");
DestroyVehicle(432);
}
return 1;
}
This code worked with the explosions though and i did the define andpublic thing ofcourse
|
Well, what iam going to show you, is to destory only a special car, not all cars :/
pawn Код:
// on the top of the script, where you have defines and forwards etc, use new destroycar
// then on the place where you have AddStaticVehicle, add before it destroycar =, so it will be like that:
// destroycar = AddStaticVehicle(modelid, x, y, z, color1, color2);
// then OnPlayer........:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
{
SetTimerEx("explosion", 20000, false, "20");
DestroyVehicle(destroycar);
}
return 1;
}
Not tested yet, so try it, may it work
Re: Destroy vehicle on TimerEX -
Jefff - 01.07.2009
Try this.
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
{
new vid = GetPlayerVehicleID(playerid);
new vehiclemod = GetVehicleModel(vid);
if(vehiclemod == 432 ) SetTimerEx("destroy", 20000, false, "d", vid);
}
return 1;
}
forward destroy(vehid);
public destroy(vehid)
{
DestroyVehicle(vehid);
return 1;
}
Re: Destroy vehicle on TimerEX -
Moustafa - 01.07.2009
Quote:
Originally Posted by Seif_ [adream-rp.com
]
Quote:
Originally Posted by Moustafa
Quote:
Originally Posted by boelie
I desperatly need a timer to destroy objects and/or vehicles
Today i tried it, i wanted to destroy a vehicle on a timer.
destroyvehicle didnt worked..so i tried it with createexplosion..well that worked but i
still cant figure out why destroyobject didnt work.
Maybe someone can explain ?
i got this now;
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
{
new vehiclemod = GetVehicleModel (GetPlayerVehicleID(playerid));
if(vehiclemod == 432 )
SetTimerEx("explosion", 20000, false, "20");
DestroyVehicle(432);
}
return 1;
}
This code worked with the explosions though and i did the define andpublic thing ofcourse
|
Well, what iam going to show you, is to destory only a special car, not all cars :/
pawn Код:
// on the top of the script, where you have defines and forwards etc, use new destroycar // then on the place where you have AddStaticVehicle, add before it destroycar =, so it will be like that: // destroycar = AddStaticVehicle(modelid, x, y, z, color1, color2); // then OnPlayer........: public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT) { SetTimerEx("explosion", 20000, false, "20"); DestroyVehicle(destroycar); }
return 1; }
Not tested yet, so try it, may it work
|
Actually, this will destroy every car the player enters if destroycar = the player's vehicle ID.
|
No, this will destroy only the AddStaticVehicle he putted the function/define at, not every one's car, he wants it for a special car, i think.
Re: Destroy vehicle on TimerEX -
boelie - 02.07.2009
Yes i want it for just one car..lets say.. a tank (ID 432)
Its for making a 'KiLLFrienzy' (like in GTA2)
so when the player enters the tank (or on playerstate) it must set the timer and say 'KiLLFrienzy'
when timer reach 0 the KiLLFrienzy is over..the tank must be destroyed and spawn back some time
later at its spawn point.
I guess it might be better if i can set an explosion on the tank when the frienzy is over so it will spawn back automaticly.
Re: Destroy vehicle on TimerEX -
boelie - 02.07.2009
Quote:
Originally Posted by boelie
Yes i want it for just one car..lets say.. a tank (ID 432)
..the tank must be destroyed and spawn back some time
|
OMG i better try setplayerhealth on a timer!
i try that now
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
{
new vehiclemod = GetVehicleModel (GetPlayerVehicleID(playerid));
if(vehiclemod == 432 )
vehiclemod = GetPlayerVehicleID(playerid);
GameTextForPlayer(playerid, "~y~Kill Frenzy!", 3000, 6);
SetTimerEx("explosion", 10000, false, "is", 1, "slut to pass");
veh = GetPlayerVehicleID(playerid);
GetVehicleHealth(veh, unheal);
SetVehicleHealth(veh,100);
//
}
return 1;
}
Still not working
Re: Destroy vehicle on TimerEX -
Moustafa - 02.07.2009
Actually the code i gave u is working for me, i hope it works for you
Re: Destroy vehicle on TimerEX -
boelie - 02.07.2009
Quote:
Originally Posted by Moustafa
Actually the code i gave u is working for me, i hope it works for you
|
ow...i thought that was for every car lol..ill check that..