Jump to content
  • 0

Item per IP


Shindu

Question


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  28
  • Reputation:   0
  • Joined:  12/09/13
  • Last Seen:  

Hey guys.

 

I want to give an item out to new players when they connect to the server however i only want it to be given out once per IP.

 

Obviously this will need to save there IP in the SQL database and check if the IP has already been added and deny the player getting the item.

 

Any suggestions on the best way to do this?

 

 

Link to comment
Share on other sites

10 answers to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

 

Any suggestions on the best way to do this?

I suggest you to use the search toolbar in script section (title with freebie or newbie), there is a lot of topics about the same request

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  96
  • Reputation:   42
  • Joined:  11/15/11
  • Last Seen:  

The problem of doing something by IP, is whose reset / change calling pro provider or even by proxy, or by unplugging the modem. If you want to give something pro player, and he does not want to earn more, I suggest you do with a normal variable (set variable, 1); and so when you want to remove his condition, only to set back to 0. It's just a suggestion. ;)
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  36
  • Reputation:   0
  • Joined:  09/09/13
  • Last Seen:  

You can use a chek ip with a variable on the account to prevent abuse by reset/change

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  96
  • Reputation:   42
  • Joined:  11/15/11
  • Last Seen:  

You can use a chek ip with a variable on the account to prevent abuse by reset/change

 

Indeed, it could set the IP in a permanent variable on the account, then the IP it was different (IP_VARIABLE != IP_ACC) from the IP of the account, he would be forced to leave the server, it makes sense. ;)
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  127
  • Topics Per Day:  0.03
  • Content Count:  1445
  • Reputation:   163
  • Joined:  08/17/13
  • Last Seen:  

You can use mine

well not totally mine, i didn't made it, dunno who is the author so, you can modify it as you need, i use this one, i hope it helps

prontera,153,177,5	script	Freebies	123,{
    query_sql ("SELECT `last_ip` FROM `login` WHERE `account_id`= '" + getcharid(3) + "'", .@lip$);
    mes "Hello and welcome to the server.";
    mes "I will give you a Freebie depending on your class.";
    mes "Enjoy the server!.";

    if(!#Freebie && ( getd("$" + .@lip$ + "_ASD") == 0 )) {
        mes "Select a Freebie:";
        next;
        switch(select("Swordsman:Magician:Archer:Acolyte:Merchant:Thief:Super Novice:Taekwon:Ninja")) {
            case 1:
                getitem 2229,1; //helm
                getitem 1117,1; //weapon
                getitem 2104,1; //shield
                getitem 2506,1; //manteau
                getitem 2406,1; //shoes
                getitem 2680,1; //acces 2
                //Item for Swordsman
                break;

            case 2:
                getitem 5027,1; //helm
                getitem 2322,1; //armor
                getitem 1619,1; //weapon
                getitem 2121,1; //shield
                getitem 2504,1; //manteau
                getitem 2404,1; //shoes
                //Item for Magician
                break;

            case 3:
                getitem 2285,1; //helm
                getitem 1705,1; //weapon
                getitem 2506,1; //manteau
                getitem 2406,1; //shoes
                //Item for Archer
                break;
                
            case 4:
                getitem 2249,1; //helm
                getitem 1520,1; //weapon
                getitem 2104,1; //shield
                getitem 2504,1; //manteau
                getitem 2404,1; //shoes
                //Item for Acolyte
                break;
            
            case 5:
                getitem 1309,1; //weapon
                getitem 2104,1; //shield
                getitem 2506,1; //manteau
                getitem 2406,1; //shoes
                //Item for Merchant
                break;
            
            case 6:
                getitem 1208,2; //weapon
                getitem 2104,1; //shield
                getitem 2506,1; //manteau
                getitem 2406,1; //shoes
                //Item for Thief
                break;

            case 7:
                getitem 5125,1; //helm
                getitem 2355,1; //armor
                getitem 1108,1; //weapon
                getitem 1602,1; //weapon
                getitem 2116,1; //shield
                getitem 2521,1; //manteau
                getitem 2420,1; //shoes
                getitem 2628,1; //acces 2
                //Item for Super Novice
                break;

            case 8:
                getitem 5122,1; //helm
                getitem 1564,1; //weapon
                getitem 1602,1; //weapon
                getitem 2104,1; //shield
                getitem 2536,1; //manteau
                getitem 2406,1; //shoes
                //Item for Taekwon
                break;

            case 9:
                getitem 2285,1; //helm
                getitem 2353,1; //shield
                getitem 13011,1; //weapon
                getitem 13302,1; //weapon
                getitem 2120,1; //shield
                getitem 2517,1; //manteau
                getitem 2418,1; //shoes
                getitem 2627,1; //acces
                //Item for Ninja
                break;
                
            }
            set #Freebie, 1;
            setd "$" + .@lip$ + "_ASD", getd("$" + .@lip$ + "_ASD") + 1;
            close;
    }
    OnInit:
    waitingroom "Freebies",0;
    end;
}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  96
  • Reputation:   42
  • Joined:  11/15/11
  • Last Seen:  

@Kido

Could make an array for items, so would make a loop for getitem, and will optimize the script enough. ;)
 
Example:
	//Array

	OnInit:
		setarray .@swordsman_itens, 2229, 1117, 2104, 2506, 2406, 2680;
		setarray .@swordsman_qtd, 0, 0, 0, 0, 0, 0; // Should you require.
	end;
	
	//Looping

	for ( set .@i, 0; .@i < getarraysize(.@swordsman_itens); set .@i, .@i + 1)
		getitem .@swordsman_itens[.@i], .@swordsman_qtd[.@i];
	break;
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

imo ... script optimization actually means make the emulator process at the least time as possible

http://userscripts.org/guides/8

in this terms, kido's script actually already optimized

what you actually did is making the script engine runs more script commands, thus process slower

there are a few stuffs you'll learn that, for example

getarraysize script command actually loops all the values in that array ...

for-loop runs 3 goto count ... ugliest loop in rathena script engine ...

if you can read source ... try imagine if your script convert into source language ...

I think you mean, making the script more user friendly =D

so people can just adjust the value from the setarray

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  96
  • Reputation:   42
  • Joined:  11/15/11
  • Last Seen:  

Thanks for the tips, served me well, I like that -> http://userscripts.org/guides/8

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  127
  • Topics Per Day:  0.03
  • Content Count:  1445
  • Reputation:   163
  • Joined:  08/17/13
  • Last Seen:  

Hey guys.

 

I want to give an item out to new players when they connect to the server however i only want it to be given out once per IP.

 

Obviously this will need to save there IP in the SQL database and check if the IP has already been added and deny the player getting the item.

 

Any suggestions on the best way to do this?

 

hey pal did my script helped you? o: if you tell me ids i can do it for you, while teaching you how to lol

pm me for this scriot support only

cya

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  66
  • Topics Per Day:  0.02
  • Content Count:  168
  • Reputation:   0
  • Joined:  11/20/13
  • Last Seen:  

@all

where i can find this in my sql database?

setd "$" + .@lip$ + "_ASD", getd("$" + .@lip$ + "_ASD") + 1;

i min how to enable theyr ip again to be able to use this npc?

and about computer shop... if 1 player use this NPC.. other player on that computer shop can not use anymore this npc?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...