Hey, Leute!
Ich habe nun endlich ein bisschen MySQL gecheckt....
Nun die Frage: Wie bekomme ich die Informationen eines angegebenen Spielers?
Kann mir da wer helfen?
ocmd:checkid(playerid,params[])
{
new id, string[128],s1[128],s2[128],s3[128],s4[128],s5[128];
if(!isPlayerAdmin(playerid,2))return SendClientMessage(playerid,arot,"Du hast nicht den passenden Adminrang.");
if(sscanf(params,"d",id))return SendClientMessage(playerid,weiß,"Info: /checkid [DatenbankID]");
s3=mysql_GetInt("players","Level","ID",id);
s5=mysql_GetInt("players","Geld","ID",id);
s4=mysql_GetInt("players","Adminlevel","ID",id);
s1=mysql_GetString("players","Name","ID",id);
s2=mysql_GetString("players","Passwort","ID",id);
format(string,sizeof(string),"[Name: %s] [Passwort: %s] [Level: %s] [Adminlevel: %s] [Geld: %s]",s1,s2,s3,s4,s5);
SendClientMessage(playerid,gelb,string);
return 1;
}
stock mysql_GetInt(Table[], Field[], Where[], Is[])
{
new query[128];
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Is, Is);
format(query, 128, "SELECT `%s` FROM `%s` WHERE `%s` = '%s'", Field, Table, Where, Is);
mysql_query(query);
mysql_store_result();
new sqlint = mysql_fetch_int();
mysql_free_result();
return sqlint;
}
stock mysql_GetString(Table[], Field[], Where[], Is[])
{
new query[128], Get[128];
mysql_real_escape_string(Table, Table);
mysql_real_escape_string(Field, Field);
mysql_real_escape_string(Where, Where);
mysql_real_escape_string(Is, Is);
format(query, 128, "SELECT `%s` FROM `%s` WHERE `%s` = '%s'", Field, Table, Where, Is);
mysql_query(query);
mysql_store_result();
mysql_fetch_row(Get);
mysql_free_result();
return Get;
}
//Errors
C:\Users\Kevin\Desktop\Sa-Mp 0.3x\gamemodes\nScript.pwn(375) : error 035: argument type mismatch (argument 4)C:\Users\Kevin\Desktop\Sa-Mp 0.3x\gamemodes\nScript.pwn(375) : error 033: array must be indexed (variable "s3")C:\Users\Kevin\Desktop\Sa-Mp 0.3x\gamemodes\nScript.pwn(376) : error 035: argument type mismatch (argument 4)C:\Users\Kevin\Desktop\Sa-Mp 0.3x\gamemodes\nScript.pwn(376) : error 033: array must be indexed (variable "s5")C:\Users\Kevin\Desktop\Sa-Mp 0.3x\gamemodes\nScript.pwn(377) : error 035: argument type mismatch (argument 4)C:\Users\Kevin\Desktop\Sa-Mp 0.3x\gamemodes\nScript.pwn(377) : error 033: array must be indexed (variable "s4")C:\Users\Kevin\Desktop\Sa-Mp 0.3x\gamemodes\nScript.pwn(378) : error 035: argument type mismatch (argument 4)C:\Users\Kevin\Desktop\Sa-Mp 0.3x\gamemodes\nScript.pwn(379) : error 035: argument type mismatch (argument 4)Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
8 Errors.