10.10.2013, 04:08
This is the coding that loads the key data files.
Here is an example of the key data file.
VehicleKey1=867
VehicleKey2=0
VehicleKey3=0
VehicleKey4=0
VehicleKey5=0
VehicleKey6=0
VehicleKey7=0
VehicleKey8=0
VehicleKey9=0
VehicleKey10=0
VehicleKey11=0
VehicleKey12=0
VehicleKey13=0
VehicleKey14=0
VehicleKey15=0
VehicleKey16=0
VehicleKey17=0
VehicleKey18=0
VehicleKey19=0
VehicleKey20=0
Код:
stock VerifyVehicle(playerid, slot) { new playername[24]; GetPlayerName(playerid, playername, sizeof(playername)); for(new i = 1; i < MAX_VEHICLES; i++) { if (strcmp(playername, VehicleEnum[i][veh_owner], false) == 0) { if (slot == VehicleEnum[i][veh_slot]) { if (VehicleKeys[playerid][slot] != i) { VehicleKeys[playerid][slot] = i; } } } } return 1; } public LoadVehicleKeys(playerid) { //if(!IsPlayerConnected(playerid)) return 0; if(!gPlayerLogged[playerid]) return 1; new filename[52], playername[24], string[48]; GetPlayerName(playerid, playername, sizeof(playername)); format(filename, sizeof(filename), "DealerInfo/keys/%s.kdat", playername); if(fexist(filename) && INI_Open(filename)) { for (new i = 1; i <= MAX_OWNED_CARS; i++) { format(string, sizeof(string), "VehicleKey%d", i); VehicleKeys[playerid][i] = INI_ReadInt(string); } INI_Close(); } for (new i = 1; i <= MAX_OWNED_CARS; i++) { VerifyVehicle(playerid, i); } return 1; }
VehicleKey1=867
VehicleKey2=0
VehicleKey3=0
VehicleKey4=0
VehicleKey5=0
VehicleKey6=0
VehicleKey7=0
VehicleKey8=0
VehicleKey9=0
VehicleKey10=0
VehicleKey11=0
VehicleKey12=0
VehicleKey13=0
VehicleKey14=0
VehicleKey15=0
VehicleKey16=0
VehicleKey17=0
VehicleKey18=0
VehicleKey19=0
VehicleKey20=0