Saving IP
#1

I am trying to get the players IP to save to his player file.

pawn Код:
new pIp[20];
    GetPlayerIp(playerid, pIp, sizeof(pIp));
    dUserSetINT(PlayerName(playerid)).("IP", strval(pIp) );
There's my code, it just saves the first part of the players IP.

For example if my IP was 92.46.436.21
It would save IP as
Код:
IP = 92
Anyone any ideas ?
Reply
#2

strval() is to convert to numbers!

just remove the strval()

pawn Код:
new pIp[20];
GetPlayerIp(playerid, pIp, sizeof(pIp));
dUserSetINT(PlayerName(playerid)).("IP", pIp );
Reply
#3

When I use that code:

Код:
C:\Documents and Settings\Compaq_Owner\Desktop\samp022server.win322\gamemodes\MY Script\When working on it\2.4.9\crrpg.pwn(48349) : error 035: argument type mismatch (argument 3)
Reply
#4

I could help you if you would use Dini.
Reply
#5

Quote:
Originally Posted by Rk_
I could help you if you would use Dini.
Sorry, I have too much stuff that works with my player files, switching systems would be too much bother.

I think I have it anyway, this seemed to work on register:

pawn Код:
new pIp[16];
    GetPlayerIp(playerid, pIp, sizeof(pIp));
    dUserSet(PlayerName(playerid)).("IP", pIp);
Reply
#6

than just copy that piece of code for OnPlayerDisconnect or what ever part u use to store things in a file.
Reply
#7

Hmmmm......
pawn Код:
new pIp[16];
    GetPlayerIp(playerid, pIp, sizeof(pIp));
    dUserSet(PlayerName(playerid)).("IP", pIp);
Works on register, but not on anything else.....strange. :/
Any ideas ?
Reply
#8

An IP is a string not an integer.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)