Confused..
#1

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?
Reply
#2

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]);
Reply
#3

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]);
Reply
#4

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.
Reply
#5

Why ...
Код:
test.pwn(1374) : error 001: expected token: ",", but found ";"
You forgot to close all the "(" ...
!!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)