This has been annoying for ages.
#1

Alright, my issue is.. when I type /spawnfvehicle (creates a faction vehicles) then i set my faction to the same as the vehicle and then I set my rank to 6, then I type /fsave and It returns Unknown command Although if I restart the server and type /fsave (after it's loaded the vehicles from mysql).


pawn Code:
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;
 }
Reply
#2

Clearly your faction rank isn't being loaded from the DB. You can check this by printing the value of your variable after loading the player's info. from the DB.
Reply
#3

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

Quote:
Originally Posted by Dokins
View Post
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?
Sure.

And as for your other issue, you'll need to kill/stop the timers when the player exists the vehicle. I'll show you some pseudo code:

pawn Code:
SpeedoSysTimer[playerid] = SetTimerEx(...);
pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER || && oldstate == PLAYER_STATE_PASSENGER)
    {
        KillTimer(SpeedoSysTimer[playerid]);
    }
    return 1;
}
Reply
#5

Ahh thank you very much!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)