10.03.2012, 12:31
i was make a /plate system and work but on server restarts the plate delete and don-t load...this is the script
#define MAX_VEHICLE_PLATE (7)
forward LoadPlates();
public LoadPlates()
{
new File:H = fopen("CarPlates.ini",io_read);
new str[128],plate[10];
new veh = GetPlayerVehicleID(playerid);
while(fread(H, str))
{
strmid(plate,str,0,strfind(str,"=",true));
strmid(plate,str,strfind(str,"=",true),strlen(str)-1);
SetVehicleNumberPlate(veh,plate);
}
}
Ongamemodeinit:
LoadPlates();
And the command:
if(!strcmp(cmd, "/changeplate", true, 12))
{
new Tmp[124];
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.");
if(!dini_Exists("CarPlates.ini")) {
dini_Create("CarPlates.ini");
}
new Str[128];
new vehid = GetPlayerVehicleID(playerid);
format(Str,128,"%d",vehid);
dini_Set("CarPlates.ini", Str, Tmp);
SetVehicleNumberPlate(GetPlayerVehicleID(playerid) ,Tmp);
SetVehicleToRespawn(vehid);
SendClientMessage(playerid, 0xFF9900AA, "License plate changed!");
new Float, 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;
}
Please help me
#define MAX_VEHICLE_PLATE (7)
forward LoadPlates();
public LoadPlates()
{
new File:H = fopen("CarPlates.ini",io_read);
new str[128],plate[10];
new veh = GetPlayerVehicleID(playerid);
while(fread(H, str))
{
strmid(plate,str,0,strfind(str,"=",true));
strmid(plate,str,strfind(str,"=",true),strlen(str)-1);
SetVehicleNumberPlate(veh,plate);
}
}
Ongamemodeinit:
LoadPlates();
And the command:
if(!strcmp(cmd, "/changeplate", true, 12))
{
new Tmp[124];
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.");
if(!dini_Exists("CarPlates.ini")) {
dini_Create("CarPlates.ini");
}
new Str[128];
new vehid = GetPlayerVehicleID(playerid);
format(Str,128,"%d",vehid);
dini_Set("CarPlates.ini", Str, Tmp);
SetVehicleNumberPlate(GetPlayerVehicleID(playerid) ,Tmp);
SetVehicleToRespawn(vehid);
SendClientMessage(playerid, 0xFF9900AA, "License plate changed!");
new Float, 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;
}
Please help me