[Help] Am i carrying the ID propaly?
#1

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 ?
Reply
#2

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

Mowlgi!!!
Reply
#4

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?
Reply
#5

Well if this is under OnPlayerConnect it creates a car every time a player connects, but it creates it for everybody.
Reply
#6

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

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;
Reply
#8

that aint my qusetion :-/
Reply
#9

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])
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)