Confused.. - 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)
+--- Thread: Confused.. (
/showthread.php?tid=480747)
Confused.. -
Kyance - 12.12.2013
Well, I'm trying to add a IP writing on my register/login system, but i keep getting these errors:
Код:
test.pwn(1374) : error 001: expected token: ",", but found ";"
test.pwn(2064) : error 001: expected token: ",", but found ";"
test.pwn(3074) : error 001: expected token: ",", but found ";"
Lines(IN ORDER)
1374:
pawn Код:
//OnPlayerDisconnect
INI_WriteInt(File,"IP",GetPlayerIp(playerid, plrIP, sizeof(plrIP));
2064:
pawn Код:
//Register dialog
INI_WriteInt(File,"IP",GetPlayerIp(playerid, plrIP, sizeof(plrIP));
3074:
pawn Код:
//savestats command
INI_WriteInt(File,"IP",GetPlayerIp(playerid, plrIP, sizeof(plrIP));
I copy-pasted this from the wiki, should i make it into a string?
like " format(string, sizeof(string), "%d", plrIP); "
or something like that?
Re: Confused.. -
Wizzy951 - 12.12.2013
First of all you can't get player's IP when they disconnect, get it once they get connected (OnPlayerConnect and I doubt they can change their IP while they're connected) and use it later. A function by
Konstantinos:
pawn Код:
new
Player_Ip[ MAX_PLAYERS ][ 16 ]
;
// OnPlayerConnect:
GetPlayerIp( playerid, Player_Ip[ playerid ], 16 );
// Anywhere else you want to use the IP (such as passing it as an argument to format):
Player_Ip[ playerid ]
So then:
pawn Код:
INI_WriteInt(File,"IP", Player_Ip[playerid]);
Re: Confused.. -
Kyance - 12.12.2013
Quote:
Originally Posted by Wizzy951
First of all you can't get player's IP when they disconnect, get it once they get connected (OnPlayerConnect and I doubt they can change their IP while they're connected) and use it later. A function by Konstantinos:
pawn Код:
new Player_Ip[ MAX_PLAYERS ][ 16 ] ;
// OnPlayerConnect: GetPlayerIp( playerid, Player_Ip[ playerid ], 16 );
// Anywhere else you want to use the IP (such as passing it as an argument to format): Player_Ip[ playerid ][/url]
So then:
pawn Код:
INI_WriteInt(File,"IP", Player_Ip[playerid]);
|
Didn't understand how to use the "Player_Ip[ playerid ]"
Got the arguments @ INI_WriteInt(File,"IP", Player_Ip[playerid]);
Re: Confused.. -
Wizzy951 - 12.12.2013
Well in this case it's being used INI_WriteInt(File,"IP",
Player_Ip[playerid]);
An example to show the ip in message:
pawn Код:
format(string, sizeof(string), "Your IP is: %s", Player_Ip[playerid])
SendClientMessage(playerid, -1, string);
Edit: it's the placeholder where the IP is being stored.
Re: Confused.. -
Jessyy - 12.12.2013
Why ...
Код:
test.pwn(1374) : error 001: expected token: ",", but found ";"
You forgot to close all the "(" ...
!!!