09.08.2011, 22:13
Well you have to use a INI system for improve the read/write speed. you can use DINI for exemple.
Here is DINI system.
It will be like:
NOTE: This is a exemple of saving. It will save only the number of license plate
Here is DINI system.
It will be like:
pawn Код:
if(!strcmp(cmd, "/changeplate", true, 12))
{
new tmp[128], file, name[MAX_PLAYER_NAME];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
return SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /changeplate [platenumber (up to 8 chars, use '-' for space char)]");
if(!IsPlayerInAnyVehicle(playerid))
return SendClientMessage(playerid, 0xFF9900AA, "You are not in a vehicle.");
format(file, sizeof(file), "%s's plate.ini", name);
if(!dini_Exists(file)) {
dini_Create(file);
dini_IntSet(file, "CarPlate", tmp);
}
new vehid = GetPlayerVehicleID(playerid);
SetVehicleNumberPlate(GetPlayerVehicleID(playerid),tmp);
SetVehicleToRespawn(vehid);
SendClientMessage(playerid, 0xFF9900AA, "License plate changed!");
new Float:x, Float:y, Float:z, Float:a;
GetVehicleZAngle(vehid,a);
GetPlayerPos(playerid,x,y,z);
SetVehiclePos(vehid,x,y,z);
SetVehicleZAngle(vehid,a);
PutPlayerInVehicle(playerid, vehid, 0);
return 1;
}