Litte help in dialog -
N3cromancer - 28.02.2015
Hello everyone who read this topic, i making a system to find a car pos by license plate, Everywork until i arrive to the onDialogResponse, for some reason i cant get the name of the owner of the vehicle, i dont know where is the problem
This is my code
Код:
if(dialogid == DIALOG_ENCONTRAR_VEHICULO)
{
if(response && strlen(inputtext) > 0)
{
for(new i; i < sizeof(cInfo); i++)
{
//I check if the car have a license and the license is == to the inputtext
if(strcmp(cInfo[i][matricula], "Without License", false) == 0 && strcmp(cInfo[i][matricula], inputtext, true) == 0 && cInfo[i][id_x] != INVALID_VEHICLE_ID)
{
new string[160], Float:x, Float:y, Float:z, name[MAX_PLAYER_NAME];
GetPlayerName(cInfo[i][ownerID], name, MAX_PLAYER_NAME);
GetVehiclePos(cInfo[i][id_x], x, y, z);
format(string, sizeof(string), "Found Vehicle | Owner: %s | License Plate: %s", name, inputtext); // <-
SendClientMessage(playerid, -1, string);
SendClientMessage(playerid, COLOR_YELLOW, "We find the car, check the map.");
printf("DEBUG OUTFOR: Encontrado - Pos: %f,%f,%f, %s", x, y, z, name);
return 0;
}
}
SendClientMessage(playerid, -1, "Not vehicle found.");
}
else SendClientMessage(playerid, -1, "Panel closed.");
}
Thanks in advance if someone can help me
Re : Litte help in dialog -
Etolas - 28.02.2015
cInfo[i][ownerID]
Is it the SQLID or the id in the "tab list" ? Because I don't know your script and I need this element to try to help you.
Re: Re : Litte help in dialog -
N3cromancer - 28.02.2015
Quote:
Originally Posted by Etolas
cInfo[i][ownerID]
Is it the SQLID or the id in the "tab list" ? Because I don't know your script and I need this element to try to help you.
|
Is the SQL ID, omg xD.. i think that was all xD let me check Thanks for ur reply Etolas
Re : Re: Re : Litte help in dialog -
Etolas - 28.02.2015
Quote:
Originally Posted by N3cromancer
Is the SQL ID, omg xD.. i think that was all xD let me check Thanks for ur reply Etolas
|
GetPlayerName(cInfo[i][ownerID], name, MAX_PLAYER_NAME);
So, you can't do this
Write a SQL request to get the playername by SQLID. If you don't know how to do, tell me.
Re: Litte help in dialog -
N3cromancer - 28.02.2015
Etolas, 4 hours pass with this problem and you help me in 1 minute thanks alot bro, xD this is funny! (im so tired), i using the latest mysql from BlueG, how i can do it?
EDIT! I think i have done it via stock
Код:
stock GetPlayerTabId(mysql_player_id)
{
foreach(new x: Player)
{
if(pInfo[x][id_db] == mysql_player_id)
{
return pInfo[x][pID];
}
}
return INVALID_PLAYER_ID;
}
Re: Litte help in dialog -
Etolas - 28.02.2015
I do this in my script to have directly the name.
Quote:
public MySQLGetName(result[], sqlid)
{
new query[128];
format(query, sizeof(query), "SELECT `Name` FROM `players_stats` WHERE ID=%d", sqlid);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows()==0)
{return format(result, 32, "None");}
else
{
new strid[32];
if(mysql_fetch_row(strid)==1)
{
return format(result, 32, "%s", strid);
}
}
return 1;
}
|
My method could work for everything but take more ressources than yours. Just for your case, you script seems me much better than mine.
Your script there can't work for disconnect player unless you load all the sql database when GameMode Start
Re: Litte help in dialog -
N3cromancer - 28.02.2015
Thanks my friend was very good your help it work now properly!
Re: Litte help in dialog -
Etolas - 28.02.2015
Great, good luck !