MySQL GetValue script
#1

Hello everyone,

I'm busy with a gamemode from scratch. It is going to be a RolePlay server, and everything is based on MySQL. I maded a function to get a value from the users table. The problem is: No errors while compiling, but the script doesn't work!

Код:
public GetUserValue(playerid, qrow[])
{
    new playername[500];
    new qresult[500];
    new qresult2;
    GetPlayerName(playerid, playername, sizeof(playername));
    format(query, sizeof(query), "SELECT '%s' FROM users WHERE username='%s' LIMIT 1", qrow, playername);
    samp_mysql_query(query);
    samp_mysql_store_result();
    samp_mysql_fetch_row(qresult);
    qresult2 = strval(qresult);
    return qresult2;
}
So, in the script I use the function like this:
Код:
public OnPlayerSpawn(playerid)
{
	GivePlayerMoney(playerid, GetUserValue(playerid, "money"));
	
	return 1;
}
But, it doesn't work, I don't get a value from the function.
It's driving me crazy! Please help.

Thanks for now!

Bas
Reply


Messages In This Thread
MySQL GetValue script - by baske007 - 22.07.2010, 11:02
Re: MySQL GetValue script - by baske007 - 22.07.2010, 11:21
Re: MySQL GetValue script - by baske007 - 22.07.2010, 14:30
Re: MySQL GetValue script - by Vince - 22.07.2010, 14:55

Forum Jump:


Users browsing this thread: 1 Guest(s)