02.09.2012, 23:56
Hello
How can i convert this code to mysql?
How can i convert this code to mysql?
pawn Код:
new banned = dUserINT(params).("banned");
new banned = dUserINT(params).("banned");
stock MySQLSavePlayer(playerid)
{
new h, m, s;
TotalGameTime(playerid, h, m, s);
new Float:x,Float:y,Float:z, interior;
GetPlayerPos(playerid,x,y,z); interior = GetPlayerInterior(playerid);
new query[900], pname[24];
GetPlayerName(playerid, pname, 24);
format(query, sizeof(query), "UPDATE data SET score=%d, money=%d, kills=%d, deaths=%d, registered=%d, loggedin=%d, banned=%d, level=%d, cookies=%d, cakes=%d, biscuits=%d, icecreams=%d, YG=%d, unlimitedb=%d, quickweapon=%d, vgoto=%d, playerfly=%d, TP=%d, YGFunction1=%d, YGFunction2=%d, YGFunction3=%d, YGFunction4=%d, YGFunction5=%d, YGFunction6=%d, Bank=%d, weed=%d, Condoms=%d, inalcatraz=%d, hours=%d, minutes=%d, seconds=%d, x1=%d, y1=%d, z1=%d, interior1=%d, bowner=%d, bowned=%d, vowned=%d, vowner=%d, vowned2=%d, vowner2=%d, vowned3=%d, vowner3=%d, vowned4=%d, vowner4=%d, vowned5=%d, vowner5=%d WHERE user='%s'",
GetPlayerScore(playerid),
GetPlayerMoney(playerid),
PlayerInfo[playerid][Kills],
PlayerInfo[playerid][Deaths],
PlayerInfo[playerid][Registered],
PlayerInfo[playerid][LoggedIn],
//banned here
PlayerInfo[playerid][Level],
PlayerInfo[playerid][Cookies],
PlayerInfo[playerid][Cakes],
PlayerInfo[playerid][Biscuits],
PlayerInfo[playerid][IceCreams],
PlayerInfo[playerid][Rb],
PlayerInfo[playerid][Unlimitedb],
PlayerInfo[playerid][Quickweapon],
PlayerInfo[playerid][Vgoto],
PlayerInfo[playerid][PlayerFly],
PlayerInfo[playerid][TP],
PlayerInfo[playerid][YGFunction1],
PlayerInfo[playerid][YGFunction2],
PlayerInfo[playerid][YGFunction3],
PlayerInfo[playerid][YGFunction4],
PlayerInfo[playerid][YGFunction5],
PlayerInfo[playerid][YGFunction6],
PlayerInfo[playerid][bank],
PlayerInfo[playerid][weed],
PlayerInfo[playerid][condoms],
PlayerInfo[playerid][inalcatraz],
h,
m,
s,
floatround(x),
floatround(y),
floatround(z),
interior,
PlayerInfo[playerid][bowner],
PlayerInfo[playerid][bowned],
PlayerInfo[playerid][vowned],
PlayerInfo[playerid][vowner],
PlayerInfo[playerid][vowned2],
PlayerInfo[playerid][vowner2],
PlayerInfo[playerid][vowned3],
PlayerInfo[playerid][vowner3],
PlayerInfo[playerid][vowned4],
PlayerInfo[playerid][vowner4],
PlayerInfo[playerid][vowned5],
PlayerInfo[playerid][vowner5],
pname);
mysql_query(query);
}
if (dUserINT(PlayerName2(playerid)).("banned") == 1){
SendClientMessage(playerid, red, "This name is banned from this server!");
format(string,sizeof(string),"%s ID:%d was auto kicked. Reason: Name banned from server",PlayerName,playerid);
SendClientMessageToAll(grey, string); print(string);
SaveToFile("KickLog",string); Kick(playerid);}
new str[24], query[90]; mysql_real_escape_string(PlayerName2(playerid),str);
format(query, sizeof(query), "SELECT * FROM `data` WHERE `user` = '%s' && `banned` = '0'", str); mysql_query (query); mysql_store_result ();
if(mysql_num_rows ( ) != 0) {}
else
{
SendClientMessage(playerid, red, "This name is banned from this server!");
format(string,sizeof(string),"%s ID:%d was auto kicked. Reason: Name banned from server",PlayerName,playerid);
SendClientMessageToAll(grey, string); print(string);
SaveToFile("KickLog",string); Kick(playerid);
}
stock MySQLSavePlayer(playerid)
{
new h, m, s;
TotalGameTime(playerid, h, m, s);
new Float:x,Float:y,Float:z, interior;
GetPlayerPos(playerid,x,y,z); interior = GetPlayerInterior(playerid);
new query[900], pname[24];
GetPlayerName(playerid, pname, 24);
format(query, sizeof(query), "UPDATE data SET score=%d, money=%d, kills=%d, deaths=%d, loggedin=%d, Bank=%d, weed=%d, Condoms=%d, inalcatraz=%d, hours=%d, minutes=%d, seconds=%d, x1=%d, y1=%d, z1=%d, interior1=%d, bowner=%d, bowned=%d, vowned=%d, vowner=%d, vowned2=%d, vowner2=%d, vowned3=%d, vowner3=%d, vowned4=%d, vowner4=%d, vowned5=%d, vowner5=%d WHERE user='%s'",
GetPlayerScore(playerid),
GetPlayerMoney(playerid),
PlayerInfo[playerid][Kills],
PlayerInfo[playerid][Deaths],
PlayerInfo[playerid][LoggedIn],
PlayerInfo[playerid][bank],
PlayerInfo[playerid][weed],
PlayerInfo[playerid][condoms],
PlayerInfo[playerid][inalcatraz],
h,
m,
s,
floatround(x),
floatround(y),
floatround(z),
interior,
PlayerInfo[playerid][bowner],
PlayerInfo[playerid][bowned],
PlayerInfo[playerid][vowned]
PlayerInfo[playerid][vowner]
PlayerInfo[playerid][vowned2]
PlayerInfo[playerid][vowner2]
PlayerInfo[playerid][vowned3]
PlayerInfo[playerid][vowner3]
PlayerInfo[playerid][vowned4]
PlayerInfo[playerid][vowner4]
PlayerInfo[playerid][vowned5]
PlayerInfo[playerid][vowner5]
pname);
mysql_query(query);
}