MySQL Help
#1

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.
Reply
#2

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.
Reply
#3

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)