CMD:fsave(playerid, params[])
{
if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
if(FRank[playerid] < 6) return SendClientMessage(playerid, COLOUR_GREY, "You are not a high enough rank.");
new vehicleid = GetPlayerVehicleID(playerid);
new VSQLID = MySQL_GetValue(vehicleid, "id", "factionvehicles");
Faction[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "faction", "accounts");
VehicleFaction[VSQLID] = MySQL_GetValue(vehicleid, "faction", "factionvehicles");
if(Faction[playerid] != VehicleFaction[VSQLID] || Faction[playerid] != VehicleFaction[vehicleid]) return SendClientMessage(playerid, COLOUR_GREY, "You are not in this faction.");
new Float:x, Float:y, Float:z, Float:a;
if(IsPlayerInAnyVehicle(playerid) && VehicleFaction[vehicleid] >= 1 || IsPlayerInAnyVehicle(playerid) != VehicleFaction[VSQLID])
GetVehiclePos(vehicleid, x, y, z);
GetVehicleZAngle(vehicleid, Float:a);
VehicleX[VSQLID] = x;
MySQL_SetFloat(VSQLID, "VehicleX", x, "factionvehicles");
VehicleY[VSQLID] = y;
MySQL_SetFloat(VSQLID, "VehicleY", y, "factionvehicles");
VehicleZ[VSQLID] = z;
MySQL_SetFloat(VSQLID, "VehicleZ", z, "factionvehicles");
VehicleAngle[VSQLID] = a;
MySQL_SetFloat(VSQLID, "VehicleAngle", a, "factionvehicles");
SendClientMessage(playerid, COLOUR_ORANGE, "Faction Vehicle Saved, It will now spawn here in the future.");
return 1;
}
Thanks realcop! On my first post (the one about the speedometer) If I leave the vehicle and go into another one and start the engine, the timers still go down quicker than they should. How do I fix this?
|
SpeedoSysTimer[playerid] = SetTimerEx(...);
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER || && oldstate == PLAYER_STATE_PASSENGER)
{
KillTimer(SpeedoSysTimer[playerid]);
}
return 1;
}