Vehicle Restriction (Faction/Rank)
#1

This displays the message to the user, but I only want it to display if they are NOT in the faction and actually remove them, but it just displays and doesnt remove the player.

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new string[35];
    new VSQLID = MySQL_GetValue(vehicleid, "id", "factionvehicles");
    vehicleid = GetPlayerVehicleID(playerid);
    VehicleFaction[vehicleid] = MySQL_GetValue(VSQLID, "Faction", "factionvehicles");
    VehicleRank[vehicleid] = MySQL_GetValue(VSQLID, "Rank", "factionvehicles");
    format(string, sizeof(string), "%s: Rank %d +", FactionName[VehicleFaction[vehicleid]], VehicleRank[vehicleid]);
    if(Faction[playerid] != VehicleFaction[vehicleid] || FRank[playerid] >= VehicleRank[vehicleid])
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, COLOUR_GREY, string);
    return 1;
}
Reply
#2

You have to use OnPlayerStateChange for that.
Reply
#3

Anything I need to change for it?
Reply
#4

Change this

pawn Код:
FRank[playerid] >= VehicleRank[vehicleid]
to
pawn Код:
FRank[playerid] < VehicleRank[vehicleid]
Reply
#5

This will cause extreme lag, if the vehicle faction information is in the server memory why would you execute a mysql query and not just read it from memory?
Reply
#6

Quote:
Originally Posted by Norn
Посмотреть сообщение
This will cause extreme lag, if the vehicle faction information is in the server memory why would you execute a mysql query and not just read it from memory?
I don't quite understand?

Also: Thanks MadeMan, + rep.
Reply
#7

Quote:
Originally Posted by Dokins
Посмотреть сообщение
I don't quite understand?

Also: Thanks MadeMan, + rep.
pawn Код:
VehicleFaction[vehicleid] = MySQL_GetValue(VSQLID, "Faction", "factionvehicles");
WHY on earth would you put that under OnPlayerEnterVehicle, it's going to load the data from mysql everytime someone enters a vehicle and cause an immense amount of lag, why not just load it when you're loading the vehicle for the first time and just compare it using the server memory?

Why are you creating separate variables for each item as well, use an enum it would be a lot cleaner..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)