Variables store. - 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)
+--- Thread: Variables store. (
/showthread.php?tid=422226)
Variables store. -
audriuxxx - 12.03.2013
Hi,
Ex: i store in variable that values:
78.4564
79.9.5
9.549
79.9.5
3.54.9
79.9.5
3.54.9
I want to do cikle or what threw that variables, and check is there more than 2 variables same than something happin...
I want to do IP protection, from mass ip. Just i want save player ip in variable, and then check how much there is ips in that variables.
new STOREIPADDRES[ 1000 ][ 20 ];
new GetPlayerIpEx[ MAX_PLAYERS ][ 25 ];
GetPlayerIp( playerid, GetPlayerIpEx[ playerid ], MAX_PLAYER_NAME );
Код:
for( IPCIKLEX[ playerid ] = 0; IPCIKLEX[ playerid ] < 999; IPCIKLEX[ playerid ] ++ )
{
if( isnull( STORESIPADDRES[ IPCIKLEX[ playerid ] ] ) )
{
strmid(STORESIPADDRES[ IPCIKLEX[ playerid ] ],GetPlayerIpEx[ playerid ],0,20,20);
break;
}
}
Re: Variables store. -
mineralo - 12.03.2013
you can't save into a variable/float any ip, use a string and compare them
Re: Variables store. -
audriuxxx - 12.03.2013
Код:
GetPlayerIp( playerid, GetPlayerIpEx[ playerid ], MAX_PLAYER_NAME );
for( IPCIKLEX[ playerid ] = 0; IPCIKLEX[ playerid ] < 100; IPCIKLEX[ playerid ] ++ )
{
if( !strcmp(STORESIPADDRES[ IPCIKLEX[ playerid ] ],"no",true ) ) //Ar zaidejas namo savininkas
{
strmid(STORESIPADDRES[ IPCIKLEX[ playerid ] ],GetPlayerIpEx[ playerid ],0,20,20);
break;
}
}
for( IPCIKLEX[ playerid ] = 0; IPCIKLEX[ playerid ] < 100; IPCIKLEX[ playerid ] ++ )
{
for( IPCIKLEX2[ playerid ] = 0; IPCIKLEX2[ playerid ] < 300; IPCIKLEX2[ playerid ] ++ )
{
if( !strcmp(STORESIPADDRES[ IPCIKLEX[ playerid ] ],STORESIPADDRES[ IPCIKLEX2[ playerid ] ],true ) ) //Ar zaidejas namo savininkas
{
COUNTIPS[ IPCIKLEX[ playerid ] ] ++;
}
}
}
for( IPCIKLEX[ playerid ] = 0; IPCIKLEX[ playerid ] < 100; IPCIKLEX[ playerid ] ++ )
{
if( COUNTIPS[ IPCIKLEX[ playerid ] ] > 3 )
{
new BANIP[ 50 ];
format(BANIP,50,"banip %s",GetPlayerIpEx[ playerid ] );
SendRconCommand(BANIP);
}
}
What bad in this code?