Reps , Help , Fast please:S -
MahdiGames - 28.01.2014
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
}
Re: Reps , Help , Fast please:S -
Abagail - 28.01.2014
Can you show a litte more code? We have no idea what this even goes along with...
Re: Reps , Help , Fast please:S -
Smileys - 28.01.2014
if( IsPlayerInVehicle( playerid, playercar ) );
DestroyVehicle( playercar );
Re: Reps , Help , Fast please:S -
MahdiGames - 28.01.2014
Quote:
Originally Posted by Smileys
if( IsPlayerInVehicle( playerid, playercar ) );
DestroyVehicle( playercar );
|
Thanks for trying to help is there are better function
Re: Reps , Help , Fast please:S -
[WSF]ThA_Devil - 28.01.2014
Quote:
Originally Posted by MahdiGames
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));
}
Re: Reps , Help , Fast please:S -
MahdiGames - 28.01.2014
Quote:
Originally Posted by [WSF]ThA_Devil
You have to work with functions that you're given....
try:
pawn Code:
if(IsPlayerInAnyVehicle(playerid){ DestroyVehicle(GetPlayerVehicleID(playerid)); }
|
Not worked :S
Re: Reps , Help , Fast please:S -
[WSF]ThA_Devil - 28.01.2014
Quote:
Originally Posted by MahdiGames
Not worked :S
|
Did it compile without errors? Since I typed it from my head....
Re: Reps , Help , Fast please:S -
MahdiGames - 28.01.2014
Quote:
Originally Posted by [WSF]ThA_Devil
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
Re: Reps , Help , Fast please:S -
Abagail - 28.01.2014
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.
Re: Reps , Help , Fast please:S -
MahdiGames - 28.01.2014
Quote:
Originally Posted by Abagail
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.