Plate system - 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: Plate system (
/showthread.php?tid=289849)
Plate system -
GTA-Roleplay - 13.10.2011
Hi, I have Plate system on my server but when you restart the server, it disappears how do I fix so that it saves
Код:
}
}
if(strcmp(x_nr,"plate",true) == 0)
{
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/v)ehicle plate [text]");
return 1;
}
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey] || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2])
{
new ownvehkey;
new car = GetPlayerVehicleID(playerid);
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { ownvehkey = PlayerInfo[playerid][pPcarkey]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { ownvehkey = PlayerInfo[playerid][pPcarkey2]; }
else { return 1; }
if(strcmp(sendername, CarInfo[ownvehkey][cOwner], true) == 0)
{
if(GetPlayerMoney(playerid) < 5000)
{
SendClientMessage(playerid,COLOR_WHITE,"You need 5000$ for the Plate Change!");
return 1;
}
strmid(CarInfo[car][cPlate], result, 0, strlen(result), 999);
new vid = GetPlayerVehicleID(playerid);
GivePlayerMoney(playerid,-5000);
SetVehicleNumberPlate(vid, CarInfo[vid][cPlate]);
RemovePlayerFromVehicle(playerid);
PlayerInfo[playerid][pPChanges] -= 1;
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
OnPropUpdate(4,car);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Please sit in your car before selling! ");
return 1;
}
Re: Plate system -
OKStyle - 13.10.2011
Write to file or database.
Re: Plate system -
GTA-Roleplay - 13.10.2011
Quote:
Originally Posted by OKStyle
Write to file or database.
|
like how xD . gimme ec :P
Re: Plate system -
Jack_Leslie - 13.10.2011
Same as the rest of your script saves...
Re: Plate system -
GTA-Roleplay - 13.10.2011
Quote:
Originally Posted by Jack_Leslie
Same as the rest of your script saves...
|
Nah come on now how to do it: P
Re: Plate system -
Jack_Leslie - 13.10.2011
Quote:
Originally Posted by GTA-Roleplay
Nah come on now how to do it: P
|
Check how the rest of your script saves? and do it that way. We don't know what file system you use so we can't tell you. It looks like an SARP edit to me?
Re: Plate system -
Retardedwolf - 13.10.2011
nah come on duud, u must lern hao 2 doe it
Re: Plate system -
OKStyle - 13.10.2011
On a
mxINI:
After
SetVehicleToRespawn(GetPlayerVehicleID(playerid));:
pawn Код:
new number[30];
format(number, sizeof(number), "%d.ini", car);
new iniFile = ini_createFile (number);
if(iniFile < 0) iniFile = ini_openFile (number);
if(iniFile >= 0)
{
ini_setString (iniFile, "NumberPlate", CarInfo[car][cPlate]);
ini_closeFile (iniFile);
}
And then vehicle death (not spawn, number sets after respawn):
pawn Код:
new number[30];
format(number, sizeof(number), "%d.ini", car);
if(fexist(number))
{
ini_getString (iniFile, "NumberPlate", CarInfo[vehicleid][cPlate]);
ini_closeFile (iniFile);
}
Try...
Re: Plate system -
GTA-Roleplay - 13.10.2011
Quote:
Originally Posted by OKStyle
On a mxINI:
After SetVehicleToRespawn(GetPlayerVehicleID(playerid));:
pawn Код:
new number[30]; format(number, sizeof(number), "%d.ini", car); new iniFile = ini_createFile (number); if(iniFile < 0) iniFile = ini_openFile (number); if(iniFile >= 0) { ini_setString (iniFile, "NumberPlate", CarInfo[car][cPlate]); ini_closeFile (iniFile); }
And then vehicle death (not spawn, number sets after respawn):
pawn Код:
new number[30]; format(number, sizeof(number), "%d.ini", car); if(fexist(number)) { ini_getString (iniFile, "NumberPlate", CarInfo[vehicleid][cPlate]); ini_closeFile (iniFile); }
Try...
|
no already fixed
not needed. thanks anyway