SA-MP Forums Archive
MDC is crashing - 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)
+--- Thread: MDC is crashing (/showthread.php?tid=601696)



MDC is crashing - lulo356 - 24.02.2016

I've created this this command to check the players MDC, but after using it the server is crashing, Thanks for your advise

PHP код:
ShowMDC(playerid, Name[])
{
    new 
Data[150],Field[258],idx, iUsername[255], iAge, iSuspect[255];
    
mysql_queryF("SELECT * FROM `Accounts` WHERE `Username` = '%s' LIMIT 1", Name);
    
mysql_store_result();
    if(
mysql_num_rows() == 1){
        
mysql_fetch_rowEx(Data);
        
Field = strtuk( Data, idx, '|' );
          for(new 
s = 0; s < 20; s++)
        {
            switch(
s)
            {
                case 
1: strmid(iUsername,Field,0,strlen(Field),255);
                case 
11: iAge = strval(Field);
                case 
20: strmid(iSuspect,Field,0,strlen(Field),255);
            }
            
Field = strtuk( Data, idx, '|' );
        }
        
mysql_free_result();
        new 
string[128], string1[258];
            
        
format(string1, sizeof(string1),"Police Mobile Database Computer: Name: %s | Age %d | Gender (coming)",iUsername, iAge );
        
SendClientMessage(playerid, ORANGE, string1);
            
        
format(string, sizeof(string), "Arrests(coming) | Wanted(coming)| Suspect:%s | Phone number:(coming)",iSuspect);
        
SendClientMessage(playerid, WHITE, string);
        }
        else
        {
            
SendClientMessage(playerid, RED, "This account doesn't exist");
    }
    return 
1;
} 
PHP код:
command(mdc, playerid, params[])
{
    new 
Name[119];
    if(
sscanf(params, "s", Name))
    {
        if(
Factions[Player[playerid][Faction]][CommandTypes] == 1 || Factions[Player[playerid][Faction]][CommandTypes] == 3)
        {
            
SendClientMessage(playerid, WHITE, "SYNTAX: /mdc [Username]");
        }
        else
        {
            
RemoveTextMessage(playerid);
            
TextDrawShowForPlayer(playerid, Text:CantCommand);
            
SetTimerEx("RemoveTextMessage", 3500, false, "d", playerid);
        }
    }
    else
    {
        if(
Factions[Player[playerid][Faction]][CommandTypes] == 1 || Factions[Player[playerid][Faction]][CommandTypes] == 3)
        {
            
format(Name,sizeof(Name),"%s", Name);
            
ShowMDC(playerid, Name);
        }
        else
        {
            
RemoveTextMessage(playerid);
            
TextDrawShowForPlayer(playerid, Text:CantCommand);
            
SetTimerEx("RemoveTextMessage", 3500, false, "d", playerid);
        }
    }
    return 
1;
} 



Re: MDC is crashing - alexanderjb918 - 24.02.2016

Server log?


Re: MDC is crashing - lulo356 - 24.02.2016

Quote:
Originally Posted by alexanderjb918
Посмотреть сообщение
Server log?
Doesn't give any warning/fails


Re: MDC is crashing - lulo356 - 25.02.2016

Quote:
Originally Posted by lulo356
Посмотреть сообщение
Doesn't give any warning/fails
PHP код:
mysql_fetch_rowEx(Data); 
this is the problm