IP help [Solved] -
CrazyChoco - 28.06.2012
Hi, how can i do like if "CrazyChoco" Connects every time he will get 1000 in money, and thats because of the script reads his ip? Ask if you didnt understand what i mean
Re: IP help -
iGetty - 28.06.2012
Well, you could use it for names?
pawn Код:
public OnPlayerConnect(playerid)
{
new name[24];
if(strmatch(name, "CrazyChoco"))
{
GivePlayerMoney(playerid, 1000);
}
return 1;
}
stock strmatch(const String1[], const String2[])
{
if ((strcmp(String1, String2, true, strlen(String2)) == 0) && (strlen(String2) == strlen(String1)))
{
return true;
}
else
{
return false;
}
}
Re: IP help -
CrazyChoco - 28.06.2012
Yea i can, i like the names, but isnt there anything with ip's? i fully respect if there isnt any
Thanks for the code
Re: IP help -
iGetty - 28.06.2012
Well, do you have a saving system at all? So then I can make it compare to the IP that's saved?
Thanks.
Re: IP help -
CrazyChoco - 28.06.2012
i use MySQL, to save all data, was it that you mean?
Re: IP help -
iGetty - 28.06.2012
Have you got something like:
?
Re: IP help - HuSs3n - 28.06.2012
comparing names is better
because your ip doesnt remain the same (only if you have a static ip)
Re: IP help -
iGetty - 28.06.2012
Quote:
Originally Posted by HuSs3n
comparing names is better
because your ip doesnt remain the same
|
That's why I gave him the name matching code first.
But if he wants the IP matches, then I'll do that for you
.
Quote:
Originally Posted by Robert West
Nize , lolz
|
Stop post count seeking. Get's boring.
Re: IP help -
phillip875 - 28.06.2012
Quote:
Originally Posted by HuSs3n
comparing names is better
because your ip doesnt remain the same
|
Actually, that varies (depends on what country your from).
Anyhow, if you are only doing it for one specific IP address:
pawn Код:
public OnPlayerConnect(playerid)
{
new ip[16];
GetPlayerIp(playerid,ip,sizeof(ip));
if(strcmp(ip,"127.0.0.1",true))
{
GivePlayerMoney(playerid,1000);
}
return 1;
}
127.0.0.1 is just an example
Re: IP help -
iGetty - 28.06.2012
Quote:
Originally Posted by phillip875
Actually, that varies (depends on what country your from).
Anyhow, if you are only doing it for one specific IP address:
pawn Код:
public OnPlayerConnect(playerid) { new ip[16]; GetPlayerIp(playerid,ip,sizeof(ip)); if(strcmp(ip,"127.0.0.1",true)) { GivePlayerMoney(playerid,1000); } return 1; }
127.0.0.1 is just an example
|
I've got a better way for him to do it, just awaiting his reply.
Edit: If you change your mind, drop me a PM mate.