24.02.2016, 22:28
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;
}