PDA

View Full Version : [Help] Plate system saving


Ofnet
07/10/2011, 06:34 AM
Hello,

I am looking for some one to help me with that plate system. I need when I use "/plate" my vehicle plate save in scriptfiles/notepad file.

with dini.

Here is the whole script of my /plate system.

if(strcmp(cmd, "/plate",true)== 0)
{
new ID = GetPlayerVehicleID(playerid);

new strings[256];
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0x00FFFFFF, "You're not in a vehicle");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /plate <License Plate>");
else
{
format(strings, sizeof(strings), "%s",tmp);
SetVehicleNumberPlate(ID,strings);
strmid(CarInfo[VehicleOwned[ID]][cLicense], strings, 0, strlen(strings), 255);
SetVehicleToRespawn(ID);
format(strings,sizeof(strings),"{00C0FF}You've changed your plate name to %s please spawn your vehicle again",tmp);
SendClientMessage(playerid, COLOR_LIGHTRED, strings);
PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
SaveCars();

}
return 1;
}


public OnVehicleSpawn(vehicleid)
{
VehicleEngine[vehicleid] = 0;
VehicleWindows[vehicleid] = 0;
CarRadio[vehicleid] = 0;
SetVehicleNumberPlate(vehicleid,CarInfo[VehicleOwned[vehicleid]][cLicense]);
if(VehicleOwned[vehicleid] != SCRIPT_CARS)
{
if(VehSpawned[vehicleid] == 0)
{
VehicleOwned[vehicleid] = SCRIPT_CARS;
DestroyVehicle(vehicleid);
VehSpawned[vehicleid] = 0;
}
else
{
VehSpawned[vehicleid] = 0;
}
}
return 1;
}

[MWR]Blood
07/10/2011, 07:09 AM
Use Y_INI.

Ofnet
07/10/2011, 07:22 AM
Can you help me with Y_INI in that Script??

[MWR]Blood
07/10/2011, 07:24 AM
Search for tutorials with it, there are a lot!

Ofnet
07/10/2011, 08:06 AM
Sir, I search the tutorial. But I'll not find any point how to add stuff in my script..

Thanks for the help!!

Mr. Random
07/10/2011, 08:25 AM
if(strcmp(cmd, "/plate",true)== 0)
{
new ID = GetPlayerVehicleID(playerid);

new strings[256];
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0x00FFFFFF, "You're not in a vehicle");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /plate <License Plate>");
else
{
format(strings, sizeof(strings), "%s",tmp);
SetVehicleNumberPlate(ID,strings);
strmid(CarInfo[VehicleOwned[ID]][cLicense], strings, 0, strlen(strings), 255);
SetVehicleToRespawn(ID);
format(strings,sizeof(strings),"{00C0FF}You've changed your plate name to %s please spawn your vehicle again",tmp);
SendClientMessage(playerid, COLOR_LIGHTRED, strings);
PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
new string[128];
format(string, sizeof(string), "plates.ini");
if(!dini_Exists(string))
{
dini_Create(string);
dini_Set(string, "License Plate", tmp);
}
SaveCars();

}
return 1;
}

Untested.

Ofnet
07/10/2011, 08:38 AM
i need to make any folder in scriptfiles??

Mr. Random
07/10/2011, 08:46 AM
No, why ? it saves in plates.ini.