Help with MYSQL
#1

Hello guys, I'm trying to make two commands for admins
1st: /stafflist (Which will get the name of all the admins and there levels)
2nd: /aka (which will get the name of all the players which are on the same IP)
Idk the query to make
I know that the query for a regular thing without sending it to client is
PHP код:
 SELECT FROM `playerdataWHERE playerLevel  >= 
But how to echo it
Those are the cmds i tried to make
PHP код:
 {
    new 
message[2500], sql[200], value[100][50];
    if(
playerData[playerid][playerScore] >= 50)
    {
        
format(sqlsizeof(sql), "SELECT * FROM `playerdata` WHERE playerLevel  >= 1");
        
mysql_query(sql);
        
mysql_store_result();
        if(
mysql_num_rows())
        {
            
mysql_fetch_row(value[5], "playerLevel");
            
mysql_fetch_row(value[0], "playerName");
            
format(messagesizeof(message), "%s{0000BB}%s"messagevalue[0]);
            
format(messagesizeof(message), "%sLevel: %s"messagevalue[5]);
            
ShowPlayerDialog(playerid10000DIALOG_STYLE_MSGBOX"Staff List"message"Close""");
        }
    }
    else
    {
        
SendClientMessage(playerid, -1"{FF0000}[ERROR] {FF0000}You must have 50 score in order to view the stafflist.");
    }
    return 
1;

PHP код:
COMMAND:aka(playeridparams[])
{
    if(
playerData[playerid][playerLoggedIn])
    {
        if(
playerData[playerid][playerLevel] >= 1)
        {
            new
            
pIP[40],
            
otherID,
            
str[130],
            
str1[130],
           
// row[200],
            
value[100][50]
            ;
            if(
sscanf(params"u"otherID))
            {
                
SendClientMessage(playerid, -1"{FF0000}[ERROR] {FFFFFF}Usage: /aka <playername/id>");
            }
            else
            {
                if(
IsPlayerConnected(otherID))
                {
                    if(
playerData[otherID][playerLoggedIn])
                    {
                           
GetPlayerIp(otherIDpIPsizeof(pIP));
                        
format(strsizeof(str), "SELECT `playerName`,`playerIP` FROM `playerdata` where `playerIP` = %s"pIP);
                        
mysql_query(str);
                        
mysql_fetch_row(value[0], "playerName");
                        
format(str1sizeof(str1), "{AFAFAF}[SERVER] {FFFFFF}The AKA on the IP %s are: %s\n"pIPvalue[0]);
                        
ShowPlayerDialog(playerid123DIALOG_STYLE_LIST," {FFFFFF}-{00FF00}Accounts On Player Ip"str1"Okay""");
                        
mysql_free_result();
                    }
                    else
                    {
                        
SendClientMessage(playerid, -1"{FF0000}[ERROR] {FFFFFF}That player is not logged in.");
                    }
                }
                else
                {
                    
SendClientMessage(playerid, -1"That player is not logged in.");
                }
            }
        }
        else
        {
            
SendClientMessage(playerid, -1"{FF0000}[ERROR]{FFFFFF} You're not authorized to use this command.");
        }
    }
    else
    {
        
SendClientMessage(playerid, -1"{FF0000}[ERROR] {FFFFFF}You must be logged in to use commands.");
    }
    return 
1;

Reply
#2

bump
Reply
#3

Are you using CZ CnR script, If yes then i can help you in PM.
Reply
#4

try this for staff command

PHP код:
CMD:staff(playerid)
{
    new 
message[2500], sql[200], value[100][50];
    if(
playerData[playerid][playerScore] >= 50)
    {
        
format(sqlsizeof(sql), "SELECT * FROM `playerdata` WHERE playerLevel  >= 1");
        
mysql_query(sql);
        
mysql_store_result();
        while(
mysql_retrieve_row())
        {
            
mysql_fetch_row(value[5], "playerLevel");
            
mysql_fetch_row(value[0], "playerName");
            
format(messagesizeof(message), "%s{0000BB}%s\tLevel: %s"messagevalue[0], value[5]);
        }
        
mysql_free_result();
        
ShowPlayerDialog(playerid10000DIALOG_STYLE_MSGBOX"Staff List"message"Close""");
    }
    else
    {
        
SendClientMessage(playerid, -1"{FF0000}[ERROR] {FF0000}You must have 50 score in order to view the stafflist.");
    }
    return 
1;

Reply
#5

Which MySQL Version are you using? I could help you more if I know the MySQL Version.
Reply
#6

@GTLS
R41 please help me fast i need it
Reply
#7

@LevelT
It says
PHP код:
error 017undefined symbol "mysql_retrieve_row"
error 027invalid character constant
error 027
invalid character constant 
Any Help please?
Reply
#8

pawn Код:
[debug] Run time error 19: "File or function is not found"
[04:40:19] [debug]  mysql_store_result
[04:40:19] [debug]  mysql_fetch_field
[04:40:19] [debug]  mysql_free_result
[04:40:19] [debug]  mysql_real_escape_string
[04:40:19] [debug]  mysql_fetch_row
[04:40:19] [debug]  mysql_num_rows
[04:40:19] [debug]  mysql_insert_id
[04:40:19] [debug]  mysql_retrieve_row
Mysql R41 Loaded but with this..
Server logs:
PHP код:
SA-MP Dedicated Server
----------------------
v0.3.7-R2, (C)2005-2015 SA-MP Team
[04:40:19
[
04:40:19Server Plugins
[04:40:19] --------------
[
04:40:19]  Loading plugincrashdetect
[04:40:19]   crashdetect v4.8.5 is OK.
[
04:40:19]   Loaded.
[
04:40:19]  Loading pluginmysql
[04:40:19]  >> plugin.mysqlR41-4 successfully loaded.
[
04:40:19]   Loaded.
[
04:40:19]  Loading pluginsscanf
[04:40:19
[
04:40:19]  ===============================
[
04:40:19]       sscanf plugin loaded.     
[
04:40:19]          Version:  2.8.1        
[04:40:19]    (c2012 Alex "******" Cole  
[04:40:19]  ===============================
[
04:40:19]   Loaded.
[
04:40:19]  Loading pluginstreamer
[04:40:19]   Loaded.
[
04:40:19]  Loaded 4 plugins.
[
04:40:19
[
04:40:19Ban list
[
04:40:19] --------
[
04:40:19]  Loadedsamp.ban
[04:40:19
[
04:40:19
[
04:40:19Filterscripts
[04:40:19] ---------------
[
04:40:19]   Loading filterscript 'antirapidfire.amx'...
[
04:40:19]   Loading filterscript 'lab.amx'...
[
04:40:19]   Loading filterscript 'stunt.amx'...
[
04:40:19]   Loading filterscript 'shouryamaps.amx'...
[
04:40:19]   Loaded 4 filterscripts.
[
04:40:19] [debugRun time error 19"File or function is not found"
[04:40:19] [debug]  mysql_store_result
[04:40:19] [debug]  mysql_fetch_field
[04:40:19] [debug]  mysql_free_result
[04:40:19] [debug]  mysql_real_escape_string
[04:40:19] [debug]  mysql_fetch_row
[04:40:19] [debug]  mysql_num_rows
[04:40:19] [debug]  mysql_insert_id
[04:40:19] [debug]  mysql_retrieve_row
[04:40:19Script[gamemodes/CnR1.amx]: Run time error 19"File or function is not found"
[04:40:19Number of vehicle models
Why?
please help
Reply
#9

in your script you using an old MySQL
Download the old version of MySQL or update your script to the latest MySQL version
Reply
#10

+slawi
What should i update in my script?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)