Hello There, Guest! Login or Register


public doesn't work
#11
(04-24-2008, 12:29 AM)Fry link Wrote: }:|

:'( :'( :'( :'( :'( :'(
Reply
#12
(04-24-2008, 12:24 AM)Fry link Wrote: Don't be too hasty to assume ;)

Code:
set_mysql_loggedin_level(prname, level)
{
       new giveplayerid[MAX_PLAYER_NAME];
    new prname[MAX_PLAYER_NAME];
    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();
}

Look at the variable declarations.
Your two variables are arrays.
The error "argument type mismatch" means that a function is not being passed the correct type of variable.
The variable "giveplayerid" should be an integer, not an array. The function GetPlayerName() will need to use an integer variable to check whose player's name to get.

Oh, by the way, don't use the script showroom for help threads. Those should go in the scripting section.
EDIT: Sorry, mis-read. I thought you was looking at the variable for actually storing the name in, not the variable for the players id!
Reply
#13
(04-24-2008, 12:06 PM)Jay link Wrote: Wrong. Those variables for getting the players name are fine, the players name has to be stored somewhere you know!

Xanland, although I havnt a clue about mysql, show us what lines are giving off warnings please.

What do you think what type of variable the first argument of GetPlayerName has to be?
Reply
#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
#15
(04-24-2008, 12:40 PM)Badeend link Wrote: What do you think what type of variable the first argument of GetPlayerName has to be?

Yea, sorry mis-read. Didn't realise he was talking about the playerid parameter!
Reply
#16
Thank you people, I changed a lot, looked at my commands. And realized that I did some wrong things. :+ So I changed that.
I now have this
Code:
038: new strlogin[256];

153: set_mysql_loggedin_level(prname, level)
154: {
155:     GetPlayerName(playerid,prname,sizeof(prname));
156:     format(strlogin, sizeof(strlogin), "UPDATE users SET loggedin='%d' WHERE name = '%s'", level,prname);
157:     samp_mysql_query(strlogin);
158:     samp_mysql_store_result();
159: }

But now I have got the following errors:
Quote:E:\samp-server\8\gamemodes\xanland.pwn(155) : error 017: undefined symbol "playerid"
E:\samp-server\8\gamemodes\xanland.pwn(155) : error 035: argument type mismatch (argument 2)
E:\samp-server\8\gamemodes\xanland.pwn(168) : error 035: argument type mismatch (argument 1)
E:\samp-server\8\gamemodes\xanland.pwn(699) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

On line 168 is this:
Code:
set_mysql_loggedin_level(sendername, 0);
and on line 699 is:
Code:
set_mysql_loggedin_level(sendername, 1);


sendername is made by GetPlayerName like in the command. 0 or 1 is the level it needs to be updated to.
Reply
#17
You didn't listen to us lol,

try adding a playerid parameter to your function, because GetPlayerName won't work because it's first argument is playerid
don't use a name variable instead of a playerid, like you have in GetPlayerName
Reply