Code:
public set_mysql_loggedin_level(pname, level)
{
new giveplayerid[MAX_PLAYER_NAME];
new prname[16];
GetPlayerName(giveplayerid,prname,sizeof(prname));
format(strlogin, sizeof(strlogin), "UPDATE users SET loggedin='%d' WHERE name = '%s'", level,prname);
samp_mysql_query(strlogin);
samp_mysql_store_result();
}
First: with "new prname[16];" well 16 is not the correct size for names the correct size is 24 or you can use MAX_PLAYER_NAME
Second: you havn't defined giveplayerid as anything so thats why GetPlayerName won't work.
Third: you have functions in that code which we don't know if you have defined & we don't know what they do
Fourth: You might want to add a loop or a playerid parameter so you can make GetPlayerName actually work properly
You can try to replace the prname parameter to a playerid parameter, therefor if your trying to use a command like /setlevel [playerid] you can set giveplayerid to strval(tmp);.
Also try changing GetPlayerName(giveplayerid,prname,sizeof(prname)); to GetPlayerName(playerid,prname,sizeof(prname));
remember to add a playerid parameter to your function
and i think your using a string as strlogin? if yes you have to add it and its size so
and i keep on spotting problems lol i just realized that you havb't defined level as anything
Quote:What do you think what type of variable the first argument of GetPlayerName has to be?
playerid xD