Posts: 517
Threads: 112
Joined: Oct 2013
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(IsPlayerInVehicle(playerid, AdminCar));
DestroyVehicle(AdminCar);
return 1;
}
Posts: 734
Threads: 8
Joined: Jun 2009
Please stop naming all of your topics "Little help", little help on what? Describe what is the problem/what you're having trouble with so others would instantly know when they look on the thread topic. Also keep it concise. I am sorry but that are just some general forum guidelines this board should enforce and I guess there just aren't enough moderators to keep an eye for this.
On topic: if the player is dead, he can't be in a vehicle, can he now? That check is useless and it's why your code is failing.
Also I don't understand what do you want, for the vehicle not to be destroyed or? You should show us more code than just one line of code where you "destroy" the vehicle.
Posts: 67
Threads: 9
Joined: Feb 2015
Reputation:
0
You could do it like that:
Create 2 variables. Use the first one save if the player is in a vehicle or not and the second one to save his vehicle id.
Then under OnPlayerStateChange update both variables depending on his new state.
When the player dies --> Check if he was in a vehicle ---> Destroy the vehicle
Posts: 734
Threads: 8
Joined: Jun 2009
Quote:
Originally Posted by Sanady
Thank you for your nicely help, but next time you don`t comment my title of topic, thank you 
|
You still haven't told us what it is that you want. For the vehicle to be destroyed or not?
If you do want the vehicle to be destroyed then save the vehicle id of the vehicle the player was previously inside, under OnPlayerStateChange check if he changed states from state driver to state wasted, check if his last vehicle was "AdminCar" (by checking if that variable you just made equals the AdminCar variable), do an inverse check of what you did under OnPlayerDeath, check if the player is not in a vehicle and destroy it, like so: "if (!IsPlayerInVehicle(playerid, AdminCar)) DestroyVehicle(AdminCar);", actually you don't need that last "IsPlayerInVehicle" check but just to play it safe...
Posts: 561
Threads: 27
Joined: Sep 2012
Quote:
Originally Posted by Virtual1ty
You still haven't told us what it is that you want.
|
Next time, read the topics carefully.
Quote:
in script is defined that if someone kill player who is in vehicle which admin gave to automaticly that vehicle will be destroyed, but it`s buggy
|
So, would you try this :
PHP код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(IsPlayerInVehicle(playerid,AdminCar))
{
DestroyVehicle(AdminCar);
return 1;
}
return 1;
}