....
DestroyVehicle(GetPVarInt(playerid, "_pCar"));
MyCar[playerid] = modelid;
DeletePVar(playerid,"_pCar");
SetPVarInt(playerid, "_pCar", CreateVehicle(MyCar[playerid], tmp_pos_x, tmp_pos_y, tmp_pos_z, tmp_angle, -1, -1, 60000));
tenta destruir a pvar e voltar-la a criar dnv..
pawn Код:
|
new
Float: tmp_pos_x,
Float: tmp_pos_y,
Float: tmp_pos_z,
Float: tmp_angle,
tmp_virtualworld,
tmp_interior
;
// O player 2 tem o veнculo, vai executar o que tem dentro do if.
if(GetPVarType(playerid, "_pCar"))
{
//stuff
}// o player 1 nгo tem o veнculo, vai executar o que tem dentro do else.
else{
cmd_mudarmc(playerid, #); // provavelmente o bug estб aqui.
}
Function::CreteVehicleForPlayer(playerid, modelid){
static
Float: tmp_pos_x,
Float: tmp_pos_y,
Float: tmp_pos_z,
Float: tmp_angle,
tmp_virtualworld,
tmp_interior
;
// variбveis ok.
Delete3DTextLabel(VText[GetPVarInt(playerid, "_pCar")]); // Nгo existe variбvel, "_pCar", ainda.
GetPlayerPos(playerid, tmp_pos_x, tmp_pos_y, tmp_pos_z);
GetPlayerFacingAngle(playerid, tmp_angle);
tmp_virtualworld = GetPlayerVirtualWorld(playerid);
tmp_interior = GetPlayerInterior(playerid);
DestroyVehicle(GetPVarInt(playerid, "_pCar")); // Nгo existe variбvel "_pCar", ainda.
//undefined behavior, jб que nгo sei o que pode retornar( acho que 0);
MyCar[playerid] = modelid;
SetPVarInt(playerid, "_pCar", CreateVehicle(MyCar[playerid], tmp_pos_x, tmp_pos_y, tmp_pos_z, tmp_angle, -1, -1, 60000)); // Criada a var "_pCar".
static
veh_id
;
veh_id = GetPVarInt(playerid, "_pCar");
//format(string, sizeof(string),"Nome: %s\nDono: %s\nTrancado: %s", vehName[modelid - 400], GetNick(playerid), CarroTrancado[veh_id] ? ("Sim") : ("Nгo"));
//VText[veh_id] = Create3DTextLabel(string, -1, 0.0, 0.0, 0.0, 50.0, 0, 1 );
format(VehDono[veh_id], 30, GetNick(playerid));
LinkVehicleToInterior(veh_id, tmp_interior);
SetVehicleVirtualWorld(veh_id, tmp_virtualworld);
PutPlayerInVehicle(playerid, veh_id, 0);
SendClientMessage(playerid, 0xE6CCFFF,"[INFO]: Desfrute de seu novo veнculo! Puxe-o digitando /mv");
return true;
}