[Please Help] How to save VehicleNumberPlate - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Please Help] How to save VehicleNumberPlate (
/showthread.php?tid=333146)
[Please Help] How to save VehicleNumberPlate -
BlackHunter - 10.04.2012
I do not know how to save the plate number, when it logout or the park the vehicle,
please help me, im newbie
I use this code..
Код:
CMD:plate(playerid,params[])
{
new plate[20],id, string[128], string2[128], splate[22], vehid, victimname[MAX_PLAYER_NAME], admname[MAX_PLAYER_NAME];
if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_GREY,"[ERROR]: You must be a RCON administrator!");
if (sscanf(params, "us[20]", id,plate)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /plate [id] [plate]");
if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_GREY,"[ERROR]: That user isn't online!");
if (strlen(plate) > 20 || strlen(plate) < 1) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /plate [id] [plate] (length 0-20)");
if (GetPlayerState(id) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid,COLOR_GREY,"[ERROR]: The player isn't the driver or he isn't at any vehicle!");
GetPlayerName(id,victimname,MAX_PLAYER_NAME); GetPlayerName(playerid,admname,MAX_PLAYER_NAME);
vehid = GetPlayerVehicleID(id);
format(string,128,"You set %s's plate to %s.",victimname,plate);
format(string2,128,"Your plate was set to %s by RCON administrator %s.",plate, admname);
format(splate, 22,"%s",plate);
SetVehicleNumberPlate(vehid, plate);
RemovePlayerFromVehicle(id);
SetTimerEx("Respawn",2000,false,"i",id);
SendClientMessage(playerid,COLOR_GREY,string);
SendClientMessage(id,COLOR_GREY,string2);
return 1;
}
Re: [Please Help] How to save VehicleNumberPlate -
BlackHunter - 11.04.2012
help me please! how to save this system?
i want try use dini.inc
Re: [Please Help] How to save VehicleNumberPlate -
Sphex - 11.04.2012
If you are using Dini (as you said) so add this:
Код:
dini_IntSet(file, "Plate", plate);
(file = the vehicle file)
Then, add this code in OnVehicleSpawn:
Код:
SetVehicleNumberPlate(vehicleid, dini_Get(file, "Plate"));