Jump to content

Comanda /staff


Domnu.MC

Recommended Posts

Stie cineva daca as putea face aceasta comanda folosind doar YSI?? Cu my-sql o am deja facuta dar am nevoie de ea si cu YSI doar si nu imi dau seama cum sa o fac

CMD:staff(playerid, params[], help) {
    if(PlayerInfo[playerid][pAdmin] < 1) return 1;    
    ShowPlayerDialog(playerid, DIALOG_STAFF, DIALOG_STYLE_LIST, "Staff", "Admins\nHelpers", "Ok", "Close");
    return 1;        
}

if(dialogid == DIALOG_STAFF) 
    {
        if(!response) return 1;
        new szQuery[1024], szResult[1024], szDialog[1024], szDialog2[4000], Cache: result;
        new szPlayers, szPlayersT;
        new szName[180], szAdmin, szLastOn[180], x, y, szTitle[180], warns, userID;
        switch(listitem) {
            case 0: {
                format(szQuery, sizeof(szQuery), "SELECT * FROM `users` WHERE `Admin`>'0' ORDER BY `users`.`Admin` ASC LIMIT 50");
                result = mysql_query(SQL, szQuery);            
                strcat(szDialog2, "Name\tStatus\tRaport\tWarns\n");
                for(new i, j = cache_get_row_count (); i < j; i++)
                {
                    cache_get_field_content(i, "name", szResult); format(szName, 256, szResult);
                    cache_get_field_content(i, "Admin", szResult); szAdmin = strval(szResult);
                    cache_get_field_content(i, "lastOn", szResult); format(szLastOn, 256, "Offline (%s)", szResult);    
                    cache_get_field_content(i, "HelpedPlayers", szResult); szPlayers = strval(szResult);
                    cache_get_field_content(i, "HelpedPlayersToday", szResult); szPlayersT = strval(szResult);
                    cache_get_field_content(i, "AW", szResult); warns = strval(szResult);
                    userID = GetPlayerID( szName );
                    if(IsPlayerConnected(userID)) format(szLastOn, 256, "Online");
                    if(!IsPlayerConnected(userID)) format(szLastOn, 256, "Offline");
                    
                    x++;
                    format(szDialog, sizeof(szDialog), "(%d) %s\t%s\t%d on this week / %d total\t%d/3\n", szAdmin, szName, szLastOn, szPlayersT, szPlayers, warns);
                    strcat(szDialog2, szDialog);            
                }
                cache_delete(result);
                format(szTitle, sizeof(szTitle), "{FFEE00}Admins (%d/%d)", GetStaffOnline(0), x);
            }
            case 1: {
                format(szQuery, sizeof(szQuery), "SELECT * FROM `users` WHERE `Helper`>'0' ORDER BY `users`.`Helper` ASC LIMIT 50");
                result = mysql_query(SQL, szQuery);                
                strcat(szDialog2, "Name\tStatus\tRaport\tWarns\n");
                for(new i, j = cache_get_row_count (); i < j; i++) {
                    cache_get_field_content(i, "name", szResult); format(szName, 256, szResult);
                    cache_get_field_content(i, "Helper", szResult); szAdmin = strval(szResult);
                    cache_get_field_content(i, "lastOn", szResult); format(szLastOn, 256, "Offline (%s)", szResult);    
                    cache_get_field_content(i, "HelpedPlayers", szResult); szPlayers = strval(szResult);
                    cache_get_field_content(i, "HelpedPlayersToday", szResult); szPlayersT = strval(szResult);
                    cache_get_field_content(i, "HW", szResult); warns = strval(szResult);
                    
                    userID = GetPlayerID( szName );
                    if(IsPlayerConnected(userID)) format(szLastOn, 256, "Online");
                    if(!IsPlayerConnected(userID)) format(szLastOn, 256, "Offline");
                    y++;
                    format(szDialog, sizeof(szDialog), "(%d) %s\t%s\t%d today / %d total\t%d/3\n", szAdmin, szName, szLastOn, szPlayersT, szPlayers, warns);
                    strcat(szDialog2, szDialog);        
                }
                cache_delete(result);
                format(szTitle, sizeof(szTitle), "{FFEE00}Helpers (%d/%d)", GetStaffOnline(1), y);
            }
        }
        ShowPlayerDialog(playerid, DIALOG_STAFF+1, DIALOG_STYLE_TABLIST_HEADERS, szTitle, szDialog2, "Ok", "Back");
    }

Link to comment
Share on other sites

#include                <YSI\y_commands>
#include                <YSI\y_master>

#include                 <YSI\y_timers>

YCMD:staff(playerid, params[], help) {

 

    if(PlayerInfo[playerid][pAdmin] < 1) return 1;    
    ShowPlayerDialog(playerid, DIALOG_STAFF, DIALOG_STYLE_LIST, "Staff", "Admins\nHelpers", "Ok", "Close");
    return 1;        
}

if(dialogid == DIALOG_STAFF) 
    {
        if(!response) return 1;
        new szQuery[1024], szResult[1024], szDialog[1024], szDialog2[4000], Cache: result;
        new szPlayers, szPlayersT;
        new szName[180], szAdmin, szLastOn[180], x, y, szTitle[180], warns, userID;
        switch(listitem) {
            case 0: {
                format(szQuery, sizeof(szQuery), "SELECT * FROM `users` WHERE `Admin`>'0' ORDER BY `users`.`Admin` ASC LIMIT 50");
                result = mysql_query(SQL, szQuery);            
                strcat(szDialog2, "Name\tStatus\tRaport\tWarns\n");
                for(new i, j = cache_get_row_count (); i < j; i++)
                {
                    cache_get_field_content(i, "name", szResult); format(szName, 256, szResult);
                    cache_get_field_content(i, "Admin", szResult); szAdmin = strval(szResult);
                    cache_get_field_content(i, "lastOn", szResult); format(szLastOn, 256, "Offline (%s)", szResult);    
                    cache_get_field_content(i, "HelpedPlayers", szResult); szPlayers = strval(szResult);
                    cache_get_field_content(i, "HelpedPlayersToday", szResult); szPlayersT = strval(szResult);
                    cache_get_field_content(i, "AW", szResult); warns = strval(szResult);
                    userID = GetPlayerID( szName );
                    if(IsPlayerConnected(userID)) format(szLastOn, 256, "Online");
                    if(!IsPlayerConnected(userID)) format(szLastOn, 256, "Offline");
                    
                    x++;
                    format(szDialog, sizeof(szDialog), "(%d) %s\t%s\t%d on this week / %d total\t%d/3\n", szAdmin, szName, szLastOn, szPlayersT, szPlayers, warns);
                    strcat(szDialog2, szDialog);            
                }
                cache_delete(result);
                format(szTitle, sizeof(szTitle), "{FFEE00}Admins (%d/%d)", GetStaffOnline(0), x);
            }
            case 1: {
                format(szQuery, sizeof(szQuery), "SELECT * FROM `users` WHERE `Helper`>'0' ORDER BY `users`.`Helper` ASC LIMIT 50");
                result = mysql_query(SQL, szQuery);                
                strcat(szDialog2, "Name\tStatus\tRaport\tWarns\n");
                for(new i, j = cache_get_row_count (); i < j; i++) {
                    cache_get_field_content(i, "name", szResult); format(szName, 256, szResult);
                    cache_get_field_content(i, "Helper", szResult); szAdmin = strval(szResult);
                    cache_get_field_content(i, "lastOn", szResult); format(szLastOn, 256, "Offline (%s)", szResult);    
                    cache_get_field_content(i, "HelpedPlayers", szResult); szPlayers = strval(szResult);
                    cache_get_field_content(i, "HelpedPlayersToday", szResult); szPlayersT = strval(szResult);
                    cache_get_field_content(i, "HW", szResult); warns = strval(szResult);
                    
                    userID = GetPlayerID( szName );
                    if(IsPlayerConnected(userID)) format(szLastOn, 256, "Online");
                    if(!IsPlayerConnected(userID)) format(szLastOn, 256, "Offline");
                    y++;
                    format(szDialog, sizeof(szDialog), "(%d) %s\t%s\t%d today / %d total\t%d/3\n", szAdmin, szName, szLastOn, szPlayersT, szPlayers, warns);
                    strcat(szDialog2, szDialog);        
                }
                cache_delete(result);
                format(szTitle, sizeof(szTitle), "{FFEE00}Helpers (%d/%d)", GetStaffOnline(1), y);
            }
        }
        ShowPlayerDialog(playerid, DIALOG_STAFF+1, DIALOG_STYLE_TABLIST_HEADERS, szTitle, szDialog2, "Ok", "Back");
    }

  • Like 1
Link to comment
Share on other sites

4 hours ago, RazvanYT said:

#include                <YSI\y_commands>
#include                <YSI\y_master>

#include                 <YSI\y_timers>

YCMD:staff(playerid, params[], help) {

 

    if(PlayerInfo[playerid][pAdmin] < 1) return 1;    
    ShowPlayerDialog(playerid, DIALOG_STAFF, DIALOG_STYLE_LIST, "Staff", "Admins\nHelpers", "Ok", "Close");
    return 1;        
}

if(dialogid == DIALOG_STAFF) 
    {
        if(!response) return 1;
        new szQuery[1024], szResult[1024], szDialog[1024], szDialog2[4000], Cache: result;
        new szPlayers, szPlayersT;
        new szName[180], szAdmin, szLastOn[180], x, y, szTitle[180], warns, userID;
        switch(listitem) {
            case 0: {
                format(szQuery, sizeof(szQuery), "SELECT * FROM `users` WHERE `Admin`>'0' ORDER BY `users`.`Admin` ASC LIMIT 50");
                result = mysql_query(SQL, szQuery);            
                strcat(szDialog2, "Name\tStatus\tRaport\tWarns\n");
                for(new i, j = cache_get_row_count (); i < j; i++)
                {
                    cache_get_field_content(i, "name", szResult); format(szName, 256, szResult);
                    cache_get_field_content(i, "Admin", szResult); szAdmin = strval(szResult);
                    cache_get_field_content(i, "lastOn", szResult); format(szLastOn, 256, "Offline (%s)", szResult);    
                    cache_get_field_content(i, "HelpedPlayers", szResult); szPlayers = strval(szResult);
                    cache_get_field_content(i, "HelpedPlayersToday", szResult); szPlayersT = strval(szResult);
                    cache_get_field_content(i, "AW", szResult); warns = strval(szResult);
                    userID = GetPlayerID( szName );
                    if(IsPlayerConnected(userID)) format(szLastOn, 256, "Online");
                    if(!IsPlayerConnected(userID)) format(szLastOn, 256, "Offline");
                    
                    x++;
                    format(szDialog, sizeof(szDialog), "(%d) %s\t%s\t%d on this week / %d total\t%d/3\n", szAdmin, szName, szLastOn, szPlayersT, szPlayers, warns);
                    strcat(szDialog2, szDialog);            
                }
                cache_delete(result);
                format(szTitle, sizeof(szTitle), "{FFEE00}Admins (%d/%d)", GetStaffOnline(0), x);
            }
            case 1: {
                format(szQuery, sizeof(szQuery), "SELECT * FROM `users` WHERE `Helper`>'0' ORDER BY `users`.`Helper` ASC LIMIT 50");
                result = mysql_query(SQL, szQuery);                
                strcat(szDialog2, "Name\tStatus\tRaport\tWarns\n");
                for(new i, j = cache_get_row_count (); i < j; i++) {
                    cache_get_field_content(i, "name", szResult); format(szName, 256, szResult);
                    cache_get_field_content(i, "Helper", szResult); szAdmin = strval(szResult);
                    cache_get_field_content(i, "lastOn", szResult); format(szLastOn, 256, "Offline (%s)", szResult);    
                    cache_get_field_content(i, "HelpedPlayers", szResult); szPlayers = strval(szResult);
                    cache_get_field_content(i, "HelpedPlayersToday", szResult); szPlayersT = strval(szResult);
                    cache_get_field_content(i, "HW", szResult); warns = strval(szResult);
                    
                    userID = GetPlayerID( szName );
                    if(IsPlayerConnected(userID)) format(szLastOn, 256, "Online");
                    if(!IsPlayerConnected(userID)) format(szLastOn, 256, "Offline");
                    y++;
                    format(szDialog, sizeof(szDialog), "(%d) %s\t%s\t%d today / %d total\t%d/3\n", szAdmin, szName, szLastOn, szPlayersT, szPlayers, warns);
                    strcat(szDialog2, szDialog);        
                }
                cache_delete(result);
                format(szTitle, sizeof(szTitle), "{FFEE00}Helpers (%d/%d)", GetStaffOnline(1), y);
            }
        }
        ShowPlayerDialog(playerid, DIALOG_STAFF+1, DIALOG_STYLE_TABLIST_HEADERS, szTitle, szDialog2, "Ok", "Back");
    }

Este buna si comanda asta, dar eu as avea nevoie gen sa modific din  asa zisa baza de date pe care o creeaza YSI,  sa pot verifica datele unui player offline 

Edited by Domnu.MC
Exprimare gresita
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.