public OnPlayerDisconnect(playerid, reason) {
if(usingcarwash == playerid)
{
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
usingcarwash = -1;
Update3DTextLabelText(entrancetext, 0x008B00FF, "Autolavaggio libero, suona il clacson per lavare\nla tua auto, ($5)");
}
Delete3DTextLabel(playerID[playerid]);
#if defined FOR_EACH
Itter_Remove(HSVictim, playerid);
#endif
for(new i=0;i<4;i++)
{
RemovePlayerAttachedObject(playerid,i);
}
if(RentedVehicle[playerid]!=0)
{
vehicleVariables[RentedVehicle[playerid]][Rented]=0;
SetVehicleToRespawn(RentedVehicle[playerid]);
RentedVehicle[playerid]=0;
}
DrugOnPlayerDisconnect(playerid, reason);
KillTimer(timer[playerid]);
KillTimer(timer2[playerid]);
TextDrawDestroy(Fuel0[playerid]);
TextDrawDestroy(Speedom[playerid]);
if(PlayerAccount[playerid][Logged]) SavePlayerAccount(playerid);
FadePlayerDisconnect(playerid);
TextDrawDestroy(Speedo[playerid]);
if (BizRobPlayer==playerid)
{
BizRobPlayer = 255;
CanRob = 0;
BizRobTime = -1;
SendClientMessageToAll(COLOR_LIGHTBLUE, "Il rapinatore si и disconnesso, rapina fallita.");
}
for(new vehid=0;vehid<MAX_VEHICLES;vehid++)
{
GetPlayerName(playerid, pname, sizeof (pname));
if(strlen(pname)==strlen(vehicleVariables[vehid][vOwner]) && !strcmp(pname,vehicleVariables[vehid][vOwner],false,MAX_PLAYER_NAME) && vehicleVariables[vehid][vOwned])
{
SavePlayerVehicle(vehid);
DestroyVehicle(vehicleVariables[vehid][vVehicleScriptID]);
}
}
SavePlayerAccount(playerid);
return 1;
}
#define SQL_DB "fenice17_project"
format(x, sizeof(x), "UPDATE `users` SET p_level = %i, p_case = %i, p_score = %i WHERE Name = '%s'", pInfo[playerid][pLevel], pInfo[playerid][pCash], pInfo[playerid][pScore], pInfo[playerid][pName]);
The query should be like this:
Code:
format(x, sizeof(x), "UPDATE `users` SET p_level = %i, p_case = %i, p_score = %i WHERE Name = '%s'", pInfo[playerid][pLevel], pInfo[playerid][pCash], pInfo[playerid][pScore], pInfo[playerid][pName]); |
public OnPlayerDisconnect(playerid, reason) {
format(x, sizeof(x), "UPDATE `users` SET p_level = %i, p_case = %i, p_score = %i WHERE Name = '%s'", pInfo[playerid][pLevel], pInfo[playerid][pCash], pInfo[playerid][pScore], pInfo[playerid][pName]);
if(usingcarwash == playerid)
{
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
usingcarwash = -1;
Update3DTextLabelText(entrancetext, 0x008B00FF, "Autolavaggio libero, suona il clacson per lavare\nla tua auto, ($5)");
}
Delete3DTextLabel(playerID[playerid]);
#if defined FOR_EACH
Itter_Remove(HSVictim, playerid);
#endif
for(new i=0;i<4;i++)
{
RemovePlayerAttachedObject(playerid,i);
}
if(RentedVehicle[playerid]!=0)
{
vehicleVariables[RentedVehicle[playerid]][Rented]=0;
SetVehicleToRespawn(RentedVehicle[playerid]);
RentedVehicle[playerid]=0;
}
DrugOnPlayerDisconnect(playerid, reason);
KillTimer(timer[playerid]);
KillTimer(timer2[playerid]);
TextDrawDestroy(Fuel0[playerid]);
TextDrawDestroy(Speedom[playerid]);
if(PlayerAccount[playerid][Logged]) SavePlayerAccount(playerid);
FadePlayerDisconnect(playerid);
TextDrawDestroy(Speedo[playerid]);
if (BizRobPlayer==playerid)
{
BizRobPlayer = 255;
CanRob = 0;
BizRobTime = -1;
SendClientMessageToAll(COLOR_LIGHTBLUE, "Il rapinatore si и disconnesso, rapina fallita.");
}
for(new vehid=0;vehid<MAX_VEHICLES;vehid++)
{
GetPlayerName(playerid, pname, sizeof (pname));
if(strlen(pname)==strlen(vehicleVariables[vehid][vOwner]) && !strcmp(pname,vehicleVariables[vehid][vOwner],false,MAX_PLAYER_NAME) && vehicleVariables[vehid][vOwned])
{
SavePlayerVehicle(vehid);
DestroyVehicle(vehicleVariables[vehid][vVehicleScriptID]);
}
}
SavePlayerAccount(playerid);
return 1;
}
new x[1024];
forward SendQuery(query[]);
public SendQuery(query[]) {
CheckSQL();
if (mysql_query(query)) {
printf("[MYSQL] MySQL query successful. (%s)", query);
}
else {
printf("[MYSQL] MySQL query unsuccessful. (%s)", query);
return false;
}
return 1;
}
format(x, sizeof(x), "UPDATE `users` SET p_level = %i, p_case = %i, p_score = %i WHERE Name = '%s'", pInfo[playerid][pLevel], pInfo[playerid][pCash], pInfo[playerid][pScore], pInfo[playerid][pName]);
SendQuery(x);