Converting dini to mysql help - 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: Converting dini to mysql help (
/showthread.php?tid=486759)
Converting dini to mysql help -
MadafakaPro - 10.01.2014
I am trying to convert this command to mysql but i am very new to mysql and i cant i dont know how.
Can somebody give me an example?
pawn Код:
COMMAND:fillhqstock(playerid)
{
if(PlayerInfo[playerid][playerteam] == CIV) return SendClientError(playerid, CANT_USE_CMD);
new fname[40];
format(fname, sizeof(fname), "/Factions/Faction-%s.txt", PlayerInfo[playerid][PTeamName]);
new pCar = GetPlayerVehicleID(playerid);
if(GetVehicleModel(pCar) != 482) return SendClientError(playerid, "You have to be in a Burrito!");
if(vehicleGuns[pCar] == 0 || vehicleBullets[pCar] == 0) return SendClientError(playerid, " You either don't have guns or bullets!");
if(GetVehiclePeople(pCar) < 3) return SendClientError(playerid, "You need atleast 3 people in your van!");
if(!IsAtOwnHQ(playerid)) return SendClientError(playerid, "You are not at your own HQ!");
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientError(playerid, "You are not the driver!");
if(dini_Int(fname, "fguns") >= dini_Int(fname, "fgunstock")) return SendClientError(playerid, "Your stock is full!");
vehicleBullets[pCar] = 0;
vehicleGuns[pCar] = 0;
dini_IntSet(fname, "fpoints", dini_Int(fname, "fpoints") + 30);
dini_IntSet(fname, "fguns", dini_Int(fname, "fguns") + 20);
SendClientMessage(playerid, COLOR_LIGHTGREY, " Excellent, the stock has been filled. See /finfo to see the status!");
SendClientMessage(playerid, COLOR_LIGHTGREY, " Your faction received: +20 weapons in the stock & +30 fpoints!");
SendClientMessage(playerid, COLOR_LIGHTGREY, " You received: $51.500");
GivePlayerMoneyEx(playerid, 51500);
format(iStr, sizeof(iStr), "# [%s] %s has filled the faction stock. (+20 weapons | +30 fpoints)", PlayerInfo[playerid][PTeamName], RPName(playerid));
SendClientMessageToTeam(PlayerInfo[playerid][playerteam],iStr,COLOR_PLAYER_VLIGHTBLUE);
return 1;
}
Re: Converting dini to mysql help -
Vince - 10.01.2014
It cannot be done in a few minutes time. It requires major changes throughout the entire script. I suggest making yourself familiar with the plugin's functions before attempting a major overhaul.
Re: Converting dini to mysql help -
MadafakaPro - 10.01.2014
I already have made the load/save system i only need to know how to conver these lines:
pawn Код:
if(dini_Int(fname, "fguns") >= dini_Int(fname, "fgunstock")) return SendClientError(playerid, "Your stock is full!");
vehicleBullets[pCar] = 0;
vehicleGuns[pCar] = 0;
dini_IntSet(fname, "fpoints", dini_Int(fname, "fpoints") + 30);
dini_IntSet(fname, "fguns", dini_Int(fname, "fguns") + 20);p
How to select the row from the mysql database and then assign it to a varibale because i am not using enums for my factions..
Re: Converting dini to mysql help -
MadafakaPro - 10.01.2014
Vince can you help me with just an example?
Re: Converting dini to mysql help -
MadafakaPro - 11.01.2014
bump anyone?