SA-MP Forums Archive
stock PlayerIP(playerid), how to make? - 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: stock PlayerIP(playerid), how to make? (/showthread.php?tid=83168)



stock PlayerIP(playerid), how to make? - Remi-X - 23.06.2009

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?



Re: stock PlayerIP(playerid), how to make? - Grim_ - 23.06.2009

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



Re: stock PlayerIP(playerid), how to make? - MenaceX^ - 23.06.2009

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.


Re: stock PlayerIP(playerid), how to make? - Grim_ - 23.06.2009

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


Re: stock PlayerIP(playerid), how to make? - Remi-X - 23.06.2009

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


Re: stock PlayerIP(playerid), how to make? - Grim_ - 23.06.2009

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.


Re: stock PlayerIP(playerid), how to make? - James_Alex - 23.06.2009

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


Re: stock PlayerIP(playerid), how to make? - OmeRinG - 23.06.2009

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


Re: stock PlayerIP(playerid), how to make? - Grim_ - 23.06.2009

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


Re: stock PlayerIP(playerid), how to make? - Remi-X - 23.06.2009

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.