NRG DestroyVehicle -
Cpt.Shady - 17.03.2012
pawn Код:
if (strcmp("/nrg", cmdtext, true, 10) == 0)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
PutPlayerInVehicle(playerid,CreateVehicle(522,X,Y,Z,0,-1,-1,-1),0);
return 1;
}
I want this command to destroy the bike to 30 seconds
help ?
Re: NRG DestroyVehicle -
GNGification - 17.03.2012
Please use [pawn] tags and you want to destroy your vehicle that you spawn? and it actually spawns
in 30 seconds? or?
Re: NRG DestroyVehicle -
Cpt.Shady - 17.03.2012
after getting out of the bike to break the 30 seconds
Re: NRG DestroyVehicle -
GNGification - 17.03.2012
I mean, its midnight here can you explain what you want to happent... xD
Wait, after you've left the vehicle it will start a timer for 30 seconds and when the timer is over the vehicle will disappear? or blow?
Re: NRG DestroyVehicle -
Cpt.Shady - 17.03.2012
disappear dude....
in brief:
I want a DestroyVehicle
and a killtimer
is so hard? ( LOL?!)
AW: NRG DestroyVehicle -
BigETI - 17.03.2012
Check in OnPlayerStateChange for if the player has exited his/her vehicle. Start there a SetTimerEx with the vehicle ID param. Of course also a callback which does also include the vehicle ID param. Inside this callback just destroy the vehicle ID. Done!
Re: NRG DestroyVehicle -
GNGification - 17.03.2012
Ah now I got it
pawn Код:
new vehicle[MAX_VEHICLES];
pawn Код:
if (strcmp("/nrg", cmdtext, true, 10) == 0)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
vehicle = CreateVehicle(522,X,Y,Z,0,-1,-1,-1),0);
PutPlayerInVehicle(playerid,vehicle(522,X,Y,Z,0,-1,-1,-1),0);
return 1;
}
OnPlayerExitVehicle
pawn Код:
if(GetPlayerVehicleID == vehicle)
{
SetTimer("destroy", SETYOURTIMEHERE, false);
return 1;
}
pawn Код:
forward destroy()
public destroy()
{
DestroyVehicle(vehicle);
return 1;
}
I cannot make sure that works because im really tired, but atleast you get the idea
Re: NRG DestroyVehicle -
Cpt.Shady - 17.03.2012
Quote:
Originally Posted by GNGification
Ah now I got it
pawn Код:
new vehicle[MAX_VEHICLES];
pawn Код:
if (strcmp("/nrg", cmdtext, true, 10) == 0) { new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid,X,Y,Z); vehicle = CreateVehicle(522,X,Y,Z,0,-1,-1,-1),0); PutPlayerInVehicle(playerid,vehicle(522,X,Y,Z,0,-1,-1,-1),0); return 1; }
OnPlayerExitVehicle
pawn Код:
if(GetPlayerVehicleID == vehicle) { SetTimer("destroy", SETYOURTIMEHERE, false); return 1; }
pawn Код:
forward destroy()[COLOR="Red"];[/COLOR] public destroy() { DestroyVehicle(vehicle); return 1; }
I cannot make sure that works because im really tired, but atleast you get the idea
|
ERROR + WARNING:
gm.pwn(1202) : error 035: argument type mismatch (argument 1)
line: public destroy()
{
DestroyVehicle(vehicle); => ( 1202)
return 1;
}
gm.pwn(10553) : warning 219: local variable "vehicle" shadows a variable at a preceding level
line: public NitroReset()
{
for(new i = 0; i<MAX_PLAYERS; i++)
{
if(!IsPlayerInInvalidNosVehicle(i,GetPlayerVehicle ID(i)))
{
new vehicle = GetPlayerVehicleID(i); =>(10553)
AddVehicleComponent(vehicle, 1010);
}
}
}
WTF?!?!?
Re: NRG DestroyVehicle -
GNGification - 17.03.2012
In my code, change ''vehicle'' to pvehicle
new pvehicle [MAX_VEHICLES];
pvehicle = createvehicle blabla
and etc
because ''vehicle'' is allready defined in your nitro function
EDIT for your latest post: Try yourself script after having a long day and tired as hell, but since there was nobody else to help I thought I should try, why not to try yourself instead asking everyone to script it for you and then ask help with problems, maybe you could learn something ^_^
Re: NRG DestroyVehicle -
Cpt.Shady - 17.03.2012
Does not work! ( thanks for nothing )
Another option?