glob variable doesn't work - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: glob variable doesn't work (
/showthread.php?tid=146508)
glob variable doesn't work -
Padarom - 07.05.2010
Hello,
my script is based on MySQL Login/Register (last can be done on our hp) selfmade.
When a user register his account a new mysql-field will be created. There's a row which is named "neu".
On the user login in my server, this variable should be loaded in the script for the user. And IF it is 1 (= true) and the player spawns, a message should appear. But it doesn't appear. Even if I set the variable on login manually ( SetPVarInt(playerid, "neu", 1); ) it doesn't work.
Here's the script:
Код:
// DCMD/SSCANF LOGIN:
dcmd_einloggen(playerid, params[])
{
if (strlen(params))
{
if(GetPVarInt(playerid, "loggedin") == 1)
{
SendClientMessage(playerid,ROT,"Du bist bereits eingeloggt.");
return 0;
}
new pName[MAX_PLAYER_NAME], query1[128], wert[2], admin1[5], warn[3], query2[128], query3[128];// query4[128], query5[128], firma11[2], firma21[2], firma31[2];
GetPlayerName(playerid, pName, sizeof pName);
format(query,sizeof query,"SELECT `neu` FROM `user` WHERE `name` = '%s'",pName);
mysql_query(query);
mysql_store_result();
mysql_fetch_field("neu",wert);
SetPVarInt(playerid, "neu", strval(wert));
mysql_free_result();
format(query1,sizeof query1,"SELECT `admin` FROM `user` WHERE `name` = '%s'",pName);
mysql_query(query1);
// [...]
// ONPLAYERSPAWN
if(GetPVarInt(playerid, "neu") == 1)
{
// DO THIS AND THIS
for(new i=0; i<49; i++)
{
CreatePickup(1273, 1, haus[i][0], haus[i][1], haus[i][2], -1);
}
}
I hope you can help.
Padarom
Re: glob variable doesn't work -
Gamer_Z - 07.05.2010
is the 'neu' being set to '1' succesfull? check it with prints.