SA-MP Forums Archive
How to make this code work? - 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: How to make this code work? (/showthread.php?tid=80801)



How to make this code work? - robanswe - 06.06.2009

How to make this code work?

Code:
    new Float: saveip[MAX_PLAYERS];
	GetPlayerIp(playerid, saveip[playerid], saveip[playerid], saveip[playerid], saveip[playerid]);
This give me 3 warnings...
Code:
C:\Users\Robin\Desktop\Simons server\gamemodes\lvdm.pwn(663) : warning 213: tag mismatch
C:\Users\Robin\Desktop\Simons server\gamemodes\lvdm.pwn(663) : warning 213: tag mismatch
C:\Users\Robin\Desktop\Simons server\gamemodes\lvdm.pwn(663) : warning 202: number of arguments does not match definition



Re: How to make this code work? - MenaceX^ - 06.06.2009

What are you attempting to do? To get the IP?


Re: How to make this code work? - robanswe - 06.06.2009

I want to save to ip in new Float: saveip[MAX_PLAYERS]; to be able to get the ip when the player disconnetct.. Reason: If you try GetPlayerIp in OnPlayerDisconnect its only return 255.255.255.255-_- So I want to store the ip from OnPlayerConnect so i can use it when a player Disconnect!

Sorry for my bad English! I'm from Sweden...


Re: How to make this code work? - MenaceX^ - 06.06.2009

pawn Code:
new ip[16];
GetPlayerIp(playerid,ip,sizeof(ip));



Re: How to make this code work? - robanswe - 06.06.2009

Quote:
Originally Posted by MenaceX^
pawn Code:
new ip[16];
GetPlayerIp(playerid,ip,sizeof(ip));
Thanks but I most store the id of the player to... This only store one ip on the latest connected player-_-


Re: How to make this code work? - yom - 06.06.2009

Then change it to an array like you did for the floats.

pawn Code:
new ip[MAX_PLAYERS][16];


GetPlayerIp(playerid, ip[playerid], sizeof(ip[]));



Re: How to make this code work? - robanswe - 06.06.2009

Quote:
Originally Posted by 0rb
Then change it to an array like you did for the floats.

pawn Code:
new ip[MAX_PLAYERS][16];


GetPlayerIp(playerid, ip[playerid], sizeof(ip[]));
Its works but if you try to do it whits new ip[MAX_PLAYERS][16]; you will get 2 warnings..
C:\Users\Robin\Desktop\Simons server\gamemodes\lvdm.pwn(4672) : warning 219: local variable "ip" shadows a variable at a preceding level
C:\Users\Robin\Desktop\Simons server\gamemodes\lvdm.pwn(4712) : warning 219: local variable "ip" shadows a variable at a preceding level

But this works so tank you!
new saveip[MAX_PLAYERS][16];
GetPlayerIp(playerid,saveip[playerid],sizeof(saveip[]));