Variable isn't getting called - 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: Variable isn't getting called (
/showthread.php?tid=212202)
Variable isn't getting called -
Ice-cup - 16.01.2011
Hey,
Basicly when you register you've entered a name.
This name is mname.
When you register (checked it with printf) it enters the correct name into the correct value position.
Altough when you log back in, you get nothing.
This is the line where the variable should get called back into the script:
Quote:
if( strcmp( key , "mname" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][mname] = strmid(PlayerInfo[playerid][mname], val, 0, 32); }
|
But as I said, it gives nothing.
Also printf shows me nothing here.
Re: Variable isn't getting called -
Krx17 - 16.01.2011
Could be a problem with how your using strmid. Are you sure "val" has a value?
Re: Variable isn't getting called -
Ice-cup - 16.01.2011
Not sure...
Quote:
if( strcmp( key , "city" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][city] = strval( val ); }
|
Is pretty much the same and does work, however it has a strval (val).
This login thing is an ordinary and much used callback which you can find in a lot of scripts..
I just tried to add 2 more things to it
Re: Variable isn't getting called -
Krx17 - 16.01.2011
In that first code, add printf("%s", val); and see if it prints anything.
Re: Variable isn't getting called -
Ice-cup - 16.01.2011
Spams me under with all kind of variables (which do excist).
This is so because in the onplayerlogin everything is defined with val.
Re: Variable isn't getting called -
Krx17 - 16.01.2011
Try this and see what it prints.
pawn Код:
if( strcmp( key , "mname" , true ) == 0 )
{
val = ini_GetValue( Data );
PlayerInfo[playerid][mname] = strmid(PlayerInfo[playerid][mname], val, 0, 32);
printf("%s", val); //Right Here
}
Re: Variable isn't getting called -
Ice-cup - 16.01.2011
Quote:
[21:29:32] (ONPLAYERLOG)Mname: 0
[21:29:32] (ONPLAYERLOG)Mname: 0
[21:29:32] (ONPLAYERLOG)Mname: 0.0
[21:29:32] (ONPLAYERLOG)Mname: 0.0
[21:29:32] (ONPLAYERLOG)Mname: 0.0
[21:29:32] (ONPLAYERLOG)Mname: 0
[21:29:32] (ONPLAYERLOG)Mname: 0
[21:29:32] (ONPLAYERLOG)Mname: 0
[21:29:32] Chris
[21:29:32] (ONPLAYERLOG)Mname: Chris
[21:29:32] (ONPLAYERLOG)Mname: 2
[21:29:32] (ONPLAYERLOG)Mname: 4
[21:29:32] (ONPLAYERLOG)Mname: 330390
|
Thats the part of my server log.
Obviously "Chris" was supposed to be the correct one.