mysql commands
#2

Guess this would be most compact way
pawn Код:
CMD:duty(playerid, params[], help)
{
    #pragma unused help
    #pragma unused params
    if(PlayerInfo[playerid][pLevel] < 5) return SendClientMessage(playerid, COLOR_RED, "You need to be admin to use this!");
    new string[256],pname[24];
    GetPlayerName(playerid, pname, 24);
    mysql_real_escape_string(pname,pname);
    if(PlayerInfo[playerid][pDuty] == 0) { PlayerInfo[playerid][pDuty] = 1; }
    else { PlayerInfo[playerid][pDuty] = 1; }
    format(string,sizeof(string),"{COLOR_ORANGE}Admin {COL_WHITE}%s {COLOR_ORANGE}is now %s duty",GetName(playerid),PlayerInfo[playerid][pDuty] ? ("on") : ("off"));
    SendClientMessageToAll(-1, string);
    format(string, sizeof(string), "UPDATE `playerdata` SET `duty` = '%d' WHERE `user_name` = '%s'",PlayerInfo[playerid][pDuty],pname);
    mysql_query(string);
    return 1;
}
Reply


Messages In This Thread
mysql commands - by Markus1337 - 25.01.2013, 07:56
Re: mysql commands - by ikey07 - 25.01.2013, 09:11
Re: mysql commands - by Markus1337 - 25.01.2013, 14:28

Forum Jump:


Users browsing this thread: 1 Guest(s)