[Help] Am i carrying the ID propaly? -
Mowgli - 07.08.2009
I am trying to carry the carid of the car i am creating, although when i am using Destroyvehicle and trying to lock the car later in the command it is not working, i am asuming the Variable is not correct... so does this look right?
Код:
new carcreated = CreateVehicle(CarId,Carx,Cary,Carz,Carangle,randcolor,randcolor,10000);
playercarid[playerid] = GetPlayerVehicleID(carcreated);
Is that vehicle CarCreated for all players? or just for the player, it is used under OnPlayerConnect, how can i make it just CarCreated for the playerid ?
Re: [Help] Am i carrying the ID propaly? -
MadeMan - 07.08.2009
The vehicle's ID is already saved on "carcreated" variable in our script so you don't need GetPlayerVehicleID anymore. And if you make a vehicle with CreateVehicle everybody can see and use it.
Re: [Help] Am i carrying the ID propaly? -
Antonio [G-RP] - 07.08.2009
Mowlgi!!!
Re: [Help] Am i carrying the ID propaly? -
Mowgli - 07.08.2009
Quote:
Originally Posted by MadeMan
The vehicle's ID is already saved on "carcreated" variable in our script so you don't need GetPlayerVehicleID anymore. And if you make a vehicle with CreateVehicle everybody can see and use it.
|
No i mean, is the 'carcreate' variable, a variable for everyone? or just the player who connected?
so if Player 1, conncts, that player creates a vehicle called 'carcreate'
now palyer 2 connects and creates 'carcreate'
do they have their own version of Carcreate?
Re: [Help] Am i carrying the ID propaly? -
MadeMan - 07.08.2009
Well if this is under OnPlayerConnect it creates a car every time a player connects, but it creates it for everybody.
Re: [Help] Am i carrying the ID propaly? -
Mowgli - 07.08.2009
ye i know everyone can see it, but is the ID on the 'carcreate' shared with the whole server or just the player connects..
so, player 1 connects and the CarCreate is id 235
player 2 carcreate id is 236.
now does player 1 stay as 235 or does he now share the variable with player 2 as 236
Re: [Help] Am i carrying the ID propaly? -
MadeMan - 07.08.2009
I suggest using this when want to save vehicles IDs for players.
pawn Код:
playercarid[playerid] = CreateVehicle(CarId,Carx,Cary,Carz,Carangle,randcolor,randcolor,10000);
or
pawn Код:
new carcreated = CreateVehicle(CarId,Carx,Cary,Carz,Carangle,randcolor,randcolor,10000);
playercarid[playerid] = carcreated;
Re: [Help] Am i carrying the ID propaly? -
Mowgli - 07.08.2009
that aint my qusetion :-/
Re: [Help] Am i carrying the ID propaly? -
Finn - 07.08.2009
GetPlayerVehicleID(carcreated);
Your
carcreated variable is
not a player ID, which
GetPlayerVehicleID function needs. It is the vehicle ID, because
CreateVehicle function returns the vehicle ID. So, basically this means that now the
GetPlayerVehicleID function is not working correctly.
Just like MadeMan said, use this one:
pawn Код:
playercarid[playerid] = CreateVehicle(CarId,Carx,Cary,Carz,Carangle,randcolor,randcolor,10000);
And to destroy/lock the vehicle:
pawn Код:
DestroyVehicle(playercarid[playerid])