31.07.2011, 09:30
hello.
have me small problem in mysql.
here the code:
and here the stock GetPlayerKills And GetPlayerDeath:
The problem is, it raises the kills of the player table.
Thanks in advance helpers
have me small problem in mysql.
here the code:
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
ResetPlayerWeapons(playerid);
format(String,256,"UPDATE `Users` SET `Death`=%i WHERE `Nick`='%s'",GetPlayerDeath(playerid) + 1,GetName(playerid));
mysql_query(String);
if(IsPlayerConnected(killerid))
{
SendDeathMessage(killerid,playerid,reason);
format(String,256,"UPDATE `Users` SET `Kills`=%i WHERE `Nick`='%s'",GetPlayerKills(killerid) + 1,GetName(killerid));
mysql_query(String);
if(GetPlayerKills(killerid) == Levels[GetPlayerLevel(killerid)+1])
{
format(String,256,"!%i тмд мшод %s бшлеъйре , дщзчп",GetPlayerLevel(killerid) + 1,GetName(killerid));
SendClientMessageToAllEx(killerid,c_orange,String);
format(String,256,".%i бшлеъйре , тмйъ мшод",GetPlayerLevel(killerid) + 1);
SendClientMessage(killerid,c_orange,String);
format(String,256,"/Level Commands %i - тм оръ мцфеъ бфчегеъ дзгщеъ мшод щмк дчщ",GetPlayerLevel(killerid) + 1);
SendClientMessage(killerid,c_orange,String);
format(String,256,"UPDATE `Users` SET `Level`=%i WHERE `Nick`='%s'",GetPlayerLevel(playerid) + 1,GetName(playerid));
mysql_query(String);
}
}
ResetPlayerMoney(playerid);
return true;
}
pawn Code:
stock GetPlayerKills(playerid)
{
new Kills,Query[256];
format(Query,256,"SELECT `Kills` FROM `Users` WHERE `Nick`='%s'",GetName(playerid));
mysql_query(Query);
mysql_store_result();
if(mysql_retrieve_row()) Kills = mysql_fetch_int();
mysql_free_result();
return Kills;
}
stock GetPlayerDeath(playerid)
{
new Death,szQuery[256];
format(szQuery,256,"SELECT `Death` FROM `Users` WHERE `Nick`='%s'",GetName(playerid));
mysql_query(szQuery);
mysql_store_result();
if(mysql_retrieve_row()) Death = mysql_fetch_int();
mysql_free_result();
return Death;
}
Thanks in advance helpers