Reps , Help , Fast please:S
#1

I need a function that destroy vehicle like "DestroyVehicle(playerid);", I'v tried some functions like:"
Code:
    for(new i;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInVehicle(i, vehid)) return 1;
        }
    }
But its destroy vehicles which are not occupation , please help i want code thats when player death destroy his car, and when exit from server and when exit from vehicle thanks !
Code:
public OnPlayerDisconnect(playerid, reason)
{
//AnyFunction Destroy the playerid vehicle when he leave if he was on vehicle.
return 1;
}
OnPlayerExitVehicle(p...)
{
//Send timer to destroy his vehicle if he not back with 1 min
return 1;
}
OnPlayerDeath
{
//Destroy playerid vehicle
}
Reply
#2

Can you show a litte more code? We have no idea what this even goes along with...
Reply
#3

if( IsPlayerInVehicle( playerid, playercar ) );

DestroyVehicle( playercar );
Reply
#4

Quote:
Originally Posted by Smileys
View Post
if( IsPlayerInVehicle( playerid, playercar ) );

DestroyVehicle( playercar );
Thanks for trying to help is there are better function
Reply
#5

Quote:
Originally Posted by MahdiGames
View Post
Thanks for trying to help is there are better function
You have to work with functions that you're given....

try:
pawn Code:
if(IsPlayerInAnyVehicle(playerid){
DestroyVehicle(GetPlayerVehicleID(playerid));
}
Reply
#6

Quote:
Originally Posted by [WSF]ThA_Devil
View Post
You have to work with functions that you're given....

try:
pawn Code:
if(IsPlayerInAnyVehicle(playerid){
DestroyVehicle(GetPlayerVehicleID(playerid));
}
Not worked :S
Reply
#7

Quote:
Originally Posted by MahdiGames
View Post
Not worked :S
Did it compile without errors? Since I typed it from my head....
Reply
#8

Quote:
Originally Posted by [WSF]ThA_Devil
View Post
Did it compile without errors? Since I typed it from my head....
Yes, in the fact i fixed onplayerdeath on player disconnect i need one for onplayerexit vehicle
Reply
#9

Code:
public OnPlayerDisconnect(playerid, reason)
{
if(!IsPlayerInAnyVehicle) return 0;
DestroyVehicle(GetPlayerVehicleID(playerid));
return 1;
}
OnPlayerExitVehicle(p...)
{
SetTimerEx("DestroyVehicle", 10000, false, "i", playerid);
SetPVarInt(playerid, "DestroyVehicle", vehicleid)
}
return 1;
}
OnPlayerDeath
{
if(!IsPlayerInAnyVehicle) return 0;
DestroyVehicle(GetPlayerVehicleID(playerid));
}

public DestroyVehicle(playerid)
{
new vehicleid == GetPVarInt(playerid, "DestroyVehicle");
DestroyVehicle(vehicleid);
}
Untested.
Reply
#10

Quote:
Originally Posted by Abagail
View Post
Code:
public OnPlayerDisconnect(playerid, reason)
{
if(!IsPlayerInAnyVehicle) return 0;
DestroyVehicle(GetPlayerVehicleID(playerid));
return 1;
}
OnPlayerExitVehicle(p...)
{
SetTimerEx("DestroyVehicle", 10000, false, "i", playerid);
SetPVarInt(playerid, "DestroyVehicle", vehicleid)
}
return 1;
}
OnPlayerDeath
{
if(!IsPlayerInAnyVehicle) return 0;
DestroyVehicle(GetPlayerVehicleID(playerid));
}

public DestroyVehicle(playerid)
{
new vehicleid == GetPVarInt(playerid, "DestroyVehicle");
DestroyVehicle(vehicleid);
}
Untested.
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(150) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(167) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(183) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(213) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(260) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(6709) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(9456) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(9470) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(9485) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(9499) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(9746) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(9947) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(9954) : error 021: symbol already defined: "DestroyVehicle"
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(9956) : error 001: expected token: ";", but found "=="
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(9961) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(10279) : warning 203: symbol is never used: "vehicleid"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)