02.02.2012, 19:39
Quote:
Because PlayerInfo[playerid][Vehicle] stores the model of the vehicle and not the id.
pawn Код:
|
My way of doing this:
pawn Код:
CMD:park(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][Vehkey] || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][Vehkey2] || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][Vehkey3]))
{
new videoid = GetPlayerVehicleID(playerid)
new Float:ux, Float:uy, Float:uz, Float:angle;
new string[128], vehicle[24];
GetVehicleName(videoid, vehicle, sizeof(vehicle));
GetPlayerFacingAngle(playerid, angle);
GetPlayerPos(playerid, ux, uy, uz);
format(file4, sizeof(file4), "realityrp/vehicles/%d.ini", videoid);
dini_FloatSet(file4, "vehx", ux);
dini_FloatSet(file4, "vehy", uy);
dini_FloatSet(file4, "vehz", uz);
dini_FloatSet(file4, "rot", angle);
format(string, sizeof(string), "You parked your %s here! ((It will respawn here on death))", vehicle);
SendClientMessage(playerid, COLOR_GREEN, string);
return 1;
}
else return SendClientMessage(playerid, COLOR_GREY, "This is not your vehicle!");
}
else return SendClientMessage(playerid, COLOR_GREY, "You are not in your vehicle!");
}