Little Help
#1

Hello everybody, I have little problem, I created command which is giving player vehicle and also putting player automaticly into vehicle, but when other player kill that player who is in car created by admin, car stays on same position, but 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, please check it.

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(IsPlayerInVehicle(playerid, AdminCar)) return DestroyVehicle(AdminCar);
    return 1;
}
Reply
#2

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(IsPlayerInVehicle(playerid, AdminCar));
DestroyVehicle(AdminCar);
    return 1;
}
Reply
#3

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.
Reply
#4

Quote:
Originally Posted by Virtual1ty
Посмотреть сообщение
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.
Thank you for your nicely help, but next time you don`t comment my title of topic, thank you
Reply
#5

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
Reply
#6

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...
Reply
#7

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(playeridkilleridreason)
{
   if(
IsPlayerInVehicle(playerid,AdminCar))
    {
        
DestroyVehicle(AdminCar);
        return 
1;
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)