stock PlayerIP(playerid), how to make?
#1

Hi, again a problem with a stock. This code:
pawn Код:
//OnPlayerConnect
if(!strcmp(PlayerIP(playerid), "127.0.0.1", true)){SetPlayerName(playerid, "[SX]Remi[A]");} //rule 606


//somewhere at the bottom
stock PlayerIP(playerid)
{
    new ip[16];
    GetPlayerIp(playerid, ip, sizeof(ip));
    return ip;
}
Errors:
Код:
L:\gamemodes\SX.pwn(606) : error 012: invalid function call, not a valid address
L:\gamemodes\SX.pwn(606) : warning 215: expression has no effect
L:\gamemodes\SX.pwn(606) : error 001: expected token: ";", but found ")"
L:\gamemodes\SX.pwn(606) : error 029: invalid expression, assumed zero
L:\gamemodes\SX.pwn(606) : fatal error 107: too many error messages on one line
How does this come?
Reply
#2

pawn Код:
stock PlayerIP(playerid)
{
  new ip[16];
  GetPlayerIp(playerid, ip, sizeof ip);
  return ip;
}
Reply
#3

Quote:
Originally Posted by Swift_
pawn Код:
stock PlayerIP(playerid)
{
  new ip[16];
  GetPlayerIp(playerid, ip, sizeof ip);
  return ip;
}
This what he has done..


Oh, my bad, didn't notice the missed bracket.
Reply
#4

He also changed:
ip = GetPlayerIp(playerid, ip, sizeof ip);
to what I put.
Reply
#5

Quote:
Originally Posted by Swift_
wow..he just changed his post to the correct format..
No? Your, and mine script does'nt work..
Reply
#6

Quote:
Originally Posted by Remi-X
Quote:
Originally Posted by Swift_
wow..he just changed his post to the correct format..
No? Your, and mine script does'nt work..
You did change your origional post. Once I posted mine, you changed your post to what I put.
Reply
#7

try this
pawn Код:
}

public OnPlayerConnect(playerid)
{
    if(!strcmp(PlayerIP(playerid), "127.0.0.1", true)){ SetPlayerName(playerid, "[SX]Remi[A]"); }
    return 1;
   
}

//somewhere at the bottom
stock PlayerIP(playerid)
{
    new ip[16];
    GetPlayerIp(playerid, ip, sizeof(ip));
    return ip;
}
i tested it and it works
Reply
#8

The script in the first post works alright... the errors come from somewhere else... tried it in a new pwn file and I get no errors
Reply
#9

Quote:
Originally Posted by OmeRinG
The script in the first post works alright... the errors come from somewhere else... tried it in a new pwn file and I get no errors
The errors came for what he ORIGIONALLY had. Read my second post, after putting my post, he changed the origional post
Reply
#10

ow yeah, now i know what you mean. But i copied the wrong script, but i edited my post without looking to your post, and now, it even doesn't work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)