SA-MP Forums Archive
MySQL Help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: MySQL Help (/showthread.php?tid=252058)



MySQL Help - PCheriyan007 - 30.04.2011

I've decided to make a MySQL based system by following this tutorial. I'm wondering how I would go about adding something like adminlevel and viplevel and if possible a little example command for admins (/kick) and vips (/heal). Perhaps a script where if a player enters a checkpoint it will look up whether the player is a VIP and let them tele.


Re: MySQL Help - [L3th4l] - 30.04.2011

pawn Код:
new
    VIPZOR[MAX_PLAYERS char];

CMD:test(playerid, params[])
{
    if(VIPZOR{playerid} < 0) return SendClientMessage(playerid, COLOR_RED, "You are not VIP!");
    return Ban(playerid);
}

public OPD(..)
{
    new
        iQuery[50];

    format(iQuery, sizeof(iQuery), "UPDATE `playerinfo` SET `VIP` = %d WHERE `name`= '%s'", VIPSOR{playerid}, pName(playerid));
    mysql_query(iQuery);
    return 1;
}

public OPC(..)
{
    new
        iQuery[50];

    format(iQuery, sizeof(iQuery), "SELECT * FROM `playerinfo` WHERE `name` = '%s'", pName(playerid));

    mysql_query(iQuery);
    mysql_store_result();

    // fetch row for vip and store it in the variable.
    return 1;
}
A quick view on how it should be.


Re: MySQL Help - PCheriyan007 - 30.04.2011

Quote:
Originally Posted by [L3th4l]
Посмотреть сообщение
pawn Код:
new
    VIPZOR[MAX_PLAYERS char];

CMD:test(playerid, params[])
{
    if(VIPZOR{playerid} < 0) return SendClientMessage(playerid, COLOR_RED, "You are not VIP!");
    return Ban(playerid);
}

public OPD(..)
{
    new
        iQuery[50];

    format(iQuery, sizeof(iQuery), "UPDATE `playerinfo` SET `VIP` = %d WHERE `name`= '%s'", VIPSOR{playerid}, pName(playerid));
    mysql_query(iQuery);
    return 1;
}

public OPC(..)
{
    new
        iQuery[50];

    format(iQuery, sizeof(iQuery), "SELECT * FROM `playerinfo` WHERE `name` = '%s'", pName(playerid));

    mysql_query(iQuery);
    mysql_store_result();

    // fetch row for vip and store it in the variable.
    return 1;
}
A quick view on how it should be.
could you try showing me how the script would look if i added it to the other stuff that was in the tutorial.