Hello There, Guest! Login or Register


public doesn't work
#14
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

Code:
new strlogin[96];

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
Reply


Messages In This Thread
public doesn't work - by Xanland - 04-22-2008, 06:15 PM
Re: public doesn't work - by FarePak - 04-22-2008, 09:30 PM
Re: public doesn't work - by InVion - 04-22-2008, 09:33 PM
Re: public doesn't work - by Fry - 04-22-2008, 09:49 PM
Re: public doesn't work - by HaZe - 04-22-2008, 10:00 PM
Re: public doesn't work - by Xanland - 04-23-2008, 05:39 PM
Re: public doesn't work - by Motorola - 04-24-2008, 12:00 AM
Re: public doesn't work - by Fry - 04-24-2008, 12:24 AM
Re: public doesn't work - by Motorola - 04-24-2008, 12:28 AM
Re: public doesn't work - by Fry - 04-24-2008, 12:29 AM
Re: public doesn't work - by Motorola - 04-24-2008, 01:07 AM
Re: public doesn't work - by Jay - 04-24-2008, 12:06 PM
Re: public doesn't work - by Badeend - 04-24-2008, 12:40 PM
Re: public doesn't work - by Smoke - 04-24-2008, 12:43 PM
Re: public doesn't work - by Jay - 04-24-2008, 01:08 PM
Re: public doesn't work - by Xanland - 04-24-2008, 04:42 PM
Re: public doesn't work - by Smoke - 04-25-2008, 05:07 AM