IP help [Solved]
#1

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
Reply
#2

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;
    }
}
Reply
#3

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
Reply
#4

Well, do you have a saving system at all? So then I can make it compare to the IP that's saved?

Thanks.
Reply
#5

i use MySQL, to save all data, was it that you mean?
Reply
#6

Have you got something like:

pawn Код:
PlayerData[playerid][IP]
?
Reply
#7

comparing names is better
because your ip doesnt remain the same (only if you have a static ip)
Reply
#8

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.
Reply
#9

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
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)