Posts: 353
Threads: 43
Joined: Sep 2006
04-22-2008, 06:15 PM
(This post was last modified: 04-22-2008, 06:16 PM by Xanland)
Hi All,
A short time ago I started to make a public function, but I still don't really get it.
I now have this:
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();
}
And what I think is, that I did it totally wrong!
What he needs to do is, if I do in a command in OnPlayerCommandText: set_mysql_loggedin_level(sendername, 0);
It needs to set/update the player level to 0. and if I insert 1 in the place of 0. It needs to be updated to 1. Don't look at the mysql-lines (format + 2 samp_mysql_), they are good.
I hope someone can help me!
|
Posts: 1,953
Threads: 103
Joined: Dec 2007
Err wrong section but im not sure what your trying to do
" I've tried reporting this thread to moderator but it keeps saying" " Hacking Atempt..."
|
Posts: 6,074
Threads: 283
Joined: Nov 2007
(04-22-2008, 09:30 PM)FarePak link Wrote: Err wrong section but im not sure what your trying to do
" I've tried reporting this thread to moderator but it keeps saying" " Hacking Atempt..."
why would you report to moderator... and Xanland, I dont understand what yo are asking!
|
Posts: 1,866
Threads: 161
Joined: Aug 2007
Why do you have to make it public? Can't you just call it normally?
|
Posts: 4,354
Threads: 239
Joined: Mar 2007
(04-22-2008, 09:33 PM)InVion link Wrote: why would you report to moderator... and Xanland, I dont understand what yo are asking! because invion... thats what you're supposed to do, as an alternative to mini-modding like so many people do here..
|
Posts: 353
Threads: 43
Joined: Sep 2006
It's now like this:
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();
}
Errors. If I use them like set_mysql_loggedin_level(sendername, 0); in OnPlayerCommandText. It gives this error:
Quote:E:\samp-server\8\gamemodes\xanland.pwn(156) : warning 219: local variable "prname" shadows a variable at a preceding level
E:\samp-server\8\gamemodes\xanland.pwn(157) : error 035: argument type mismatch (argument 1)
E:\samp-server\8\gamemodes\xanland.pwn(153) : warning 203: symbol is never used: "prname"
E:\samp-server\8\gamemodes\xanland.pwn(170) : error 035: argument type mismatch (argument 1)
E:\samp-server\8\gamemodes\xanland.pwn(701) : error 035: argument type mismatch (argument 1)
prname is only newly created in this function.
|
Posts: 1,214
Threads: 126
Joined: Feb 2008
xanland, you r way too more inteligent than us, i think you wont get help asking here
|
Posts: 1,866
Threads: 161
Joined: Aug 2007
04-24-2008, 12:24 AM
(This post was last modified: 04-24-2008, 12:27 AM by Fry)
(04-24-2008, 12:00 AM)Motorola link Wrote: xanland, you r way too more inteligent than us, i think you wont get help asking here
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.
|
Posts: 1,214
Threads: 126
Joined: Feb 2008
(04-24-2008, 12:24 AM)Fry link Wrote: 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.
Hey u r right those r arrays may be thats the problem
|
Posts: 1,866
Threads: 161
Joined: Aug 2007
(04-24-2008, 12:28 AM)Motorola link Wrote: Hey u r right those r arrays may be thats the problem
|
|