14.12.2013, 20:34
(
Последний раз редактировалось Jimmy0wns; 14.12.2013 в 22:46.
)
-solved-
WHERE column | operator | value
WHERE name='%s'
CMD:makeleader(playerid, params[])
{
new
targetid,
factionid,
string[128],
targetname[24],
playername[24]
;
if(sscanf(params, "ui", targetid, factionid))
return SendClientMessage(playerid, -1, "Usage: /makeleader [playerid] [factionid]");
if(IsPlayerAdmin(playerid) || pInfo[playerid][pAdmin] <= 5)
return SendClientMessage(playerid, -1, "You are not an admin");
if(!IsPlayerConnected(targetid))
return SendClientMessage(playerid, -1, "Invalid playerid!");
if(0 > factionid > 3) return SendClientMessage(playerid, -1, "Invalid factionid. Factionid's: 1-3");
GetPlayerName(playerid, playername, sizeof(playername)), GetPlayerName(targetid, targetname, sizeof(targetname));
format(string, sizeof(string), "You made %s leader of faction id %i!", targetname, factionid);
SendClientMessage(playerid, -1, string);
format(string, sizeof(string), "You were made leader of faction id %i by %s", factionid, playername);
SendClientMessage(playerid, -1, string);
pInfo[playerid][pFaction] = factionid;
pInfo[playerid][pFactionRank] = 6;
format(string, sizeof(string), "UPDATE `playerdata` SET `faction` = %i, `frank` = %i WHERE `nick` = '%s' ", pInfo[playerid][pFaction], pInfo[playerid][pFactionRank], playername);
mysql_query(string);
return true;
}
[Sat Dec 14 22:54:53 2013] Function: mysql_query executed: "UPDATE `playerdata` SET `admin` = '6' WHERE `id` = '1470' LIMIT 1" with result: "0". [Sat Dec 14 22:55:19 2013] Function: mysql_query executed: "UPDATE playerdata SET `admin` = '6', `score` = '0', `money` = '0', `cookies` = '0', `kills` = '0', `deaths` = '0' `faction` = '0', `family` = '0', `job` = '0', `fleader` = '0', `frank` = '0', WHERE `id` = '1470' LIMIT 1" with result: "1".
SavePlayer(playerid)
{
if(pInfo[playerid][Logged] == 1)
// checks if the player is logged
{
new Query[500];
format(Query, 500, "UPDATE playerdata SET `admin` = '%d', `score` = '%d', `money` = '%d', `cookies` = '%d', `kills` = '%d', `deaths` = '%d' `faction` = '%d', `family` = '%d', `job` = '%d', `fleader` = '%d', `frank` = '%d', WHERE `id` = '%d' LIMIT 1",
pInfo[playerid][pAdmin],
pInfo[playerid][pScore],
pInfo[playerid][pMoney],
pInfo[playerid][pCookies],
pInfo[playerid][pKills],
pInfo[playerid][pDeaths],
pInfo[playerid][pFaction],
pInfo[playerid][pFamily],
pInfo[playerid][pJob],
pInfo[playerid][pFactionLeader],
pInfo[playerid][pFactionRank],
pInfo[playerid][ID]);
mysql_query(Query);
}
}
I've also been having trouble with my SavePlayer function.
Errors: Код:
[Sat Dec 14 22:54:53 2013] Function: mysql_query executed: "UPDATE `playerdata` SET `admin` = '6' WHERE `id` = '1470' LIMIT 1" with result: "0". [Sat Dec 14 22:55:19 2013] Function: mysql_query executed: "UPDATE playerdata SET `admin` = '6', `score` = '0', `money` = '0', `cookies` = '0', `kills` = '0', `deaths` = '0' `faction` = '0', `family` = '0', `job` = '0', `fleader` = '0', `frank` = '0', WHERE `id` = '1470' LIMIT 1" with result: "1". pawn Код:
|
I need more information, also pFactionLeader is a string right? so as the pFaction and pFamily, recheck your code if you are using the right placeholder
|
SavePlayer(playerid)
{
if(pInfo[playerid][Logged] == 1)
// checks if the player is logged
{
new Query[500];
format(Query, 500, "UPDATE playerdata SET `admin` = '%d', `score` = '%d', `money` = '%d', `cookies` = '%d', `kills` = '%d', `deaths` = '%d', `faction` = '%d', `family` = '%d', `job` = '%d', `fleader` = '%d', `frank` = '%d' WHERE `id` = '%d' LIMIT 1",
pInfo[playerid][pAdmin],
pInfo[playerid][pScore],
pInfo[playerid][pMoney],
pInfo[playerid][pCookies],
pInfo[playerid][pKills],
pInfo[playerid][pDeaths],
pInfo[playerid][pFaction],
pInfo[playerid][pFamily],
pInfo[playerid][pJob],
pInfo[playerid][pFactionLeader],
pInfo[playerid][pFactionRank],
pInfo[playerid][ID]);
mysql_query(Query);
}
}
Should be this:
pawn Код:
|