SA-MP Forums Archive
Can someone sort this out please;3 - 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: Can someone sort this out please;3 (/showthread.php?tid=354435)



Can someone sort this out please;3 - Elysian` - 26.06.2012

If I do this(logged as RCON)
pawn Код:
CMD:setgm(playerid, params[])
{
    if(playerVariables[playerid][pGamemaster] == 5 || IsPlayerAdmin(playerid))
    {
        new id, string[128], string2[128], level, szQuery[128];
        if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "|- [Error] /setgm [id] [level]");
       
        format(string, sizeof(string), "You have set {1B8AE4}%s(%d)"COLOR_GREEN" to level %d gamemaster.", GetName(id), playerid, level);
        SendClientMessage(id, COLOR_GREEN, string);
        format(string2, sizeof(string2), "You have been given level %d gamemaster by {1B8AE4}%s(%d)", GetName(id), level);
        SendClientMessage(playerid, COLOR_GREEN, string);
        format(szQuery, sizeof(szQuery), "UPDATE players SET Gamemaster = '%d' WHERE ID = %d", playerVariables[id][pGamemaster], playerVariables[id][pDBID]);

    }
    return 1;
}
All it says is "You have set *name*(id) to a level 0 gamemaster!" even if you do "/setgm 0 5"
and sends it to you(twice)


Re: Can someone sort this out please;3 - [A]ndrei - 26.06.2012

what are the errors


Re: Can someone sort this out please;3 - Elysian` - 26.06.2012

Nothing.


Re: Can someone sort this out please;3 - ViniBorn - 26.06.2012

pawn Код:
CMD:setgm(playerid, params[])
{
    if(playerVariables[playerid][pGamemaster] == 5 || IsPlayerAdmin(playerid))
    {
        new id, level;
        if(sscanf(params, "rd", id, level)) return SendClientMessage(playerid, COLOR_RED, "|- [Error] /setgm [id] [level]");

        new szQuery[128];
        playerVariables[id][pGamemaster] = level;
        format(szQuery, sizeof(szQuery), "You have set {1B8AE4}%s(%d)"COLOR_GREEN" to level %d gamemaster.", GetName(id), id, level);
        SendClientMessage(playerid, COLOR_GREEN, szQuery);
        format(szQuery, sizeof(szQuery), "You have been given level %d gamemaster by {1B8AE4}%s(%d)", level,GetName(playerid), playerid);
        SendClientMessage(id, COLOR_GREEN, szQuery);
        format(szQuery, sizeof(szQuery), "UPDATE players SET Gamemaster = '%d' WHERE ID = %d", playerVariables[id][pGamemaster], playerVariables[id][pDBID]);

    }
    return 1;
}



Re: Can someone sort this out please;3 - [A]ndrei - 26.06.2012

ommm ill try my best i guess...

Код:
if (playerVariables[playerid][pGamemaster] == 5 || IsPlayerAdmin(playerid))
try this


Re: Can someone sort this out please;3 - ReneG - 26.06.2012

pawn Код:
format(string, sizeof(string), "You have set {1B8AE4}%s(%d)"COLOR_GREEN" to level %d gamemaster.", GetName(id), id, level);
SendClientMessage(id, COLOR_GREEN, string);
format(string2, sizeof(string2), "You have been given level %d gamemaster by {1B8AE4}%s(%d)", level, GetName(playerid));
SendClientMessage(playerid, COLOR_GREEN, string2);
You were sending 'string' twice, and your formatting was off


Re: Can someone sort this out please;3 - Elysian` - 26.06.2012

It works, but...
pawn Код:
format(szQuery, sizeof(szQuery), "UPDATE players SET Gamemaster = '%d' WHERE ID = %d", playerVariables[id][pGamemaster], playerVariables[id][pDBID]);
        ------------mysql_query(szQuery);---------------
it says mysql_query is undefined.


Re: Can someone sort this out please;3 - iGetty - 26.06.2012

You're using the R7 version of the plugin, aren't you?


Re: Can someone sort this out please;3 - Elysian` - 26.06.2012

I think so, yeah.


Re: Can someone sort this out please;3 - iGetty - 26.06.2012

Try and downgrade to the R6 version, it worked with me when I had the "undefined symbol "mysql_query" error.