Jump to content
  • 0

Guild Package[90% Working] need to fix and enhance


GM Freya

Question


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   0
  • Joined:  02/20/12
  • Last Seen:  



CREATE TABLE `guild_package` (
  `id` int(11) NOT NULL auto_increment,
  `account_id` int(11) NOT NULL default '0',
  `last_ip` varchar(100) NOT NULL default '',
  PRIMARY KEY (`account_id`),
  KEY (`id`)
) ENGINE=MyISAM;




CREATE TABLE `guild_member` (
  `guild_id` int(11) unsigned NOT NULL default '0',
  `account_id` int(11) unsigned NOT NULL default '0',
  `name` varchar(24) NOT NULL default '',
  `char_id` int(11) unsigned NOT NULL default '0',
  `last_ip` varchar(100) NOT NULL default '',
  `online` tinyint(4) unsigned NOT NULL default '0',
  `hair` tinyint(6) unsigned NOT NULL default '0',
  `hair_color` smallint(6) unsigned NOT NULL default '0',
  `gender` tinyint(6) unsigned NOT NULL default '0',
  `class` smallint(6) unsigned NOT NULL default '0',
  `lv` smallint(6) unsigned NOT NULL default '0',
  `exp` bigint(20) unsigned NOT NULL default '0',
  `exp_payper` tinyint(11) unsigned NOT NULL default '0',
  `position` tinyint(6) unsigned NOT NULL default '0',
  PRIMARY KEY  (`guild_id`,`char_id`),
  KEY `char_id` (`char_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


This is my SQL...

 



prontera,147,164,4    script    Guild Admin    88,{
    if(#Claimed == 1) goto L_AG;
    if ( getguildmaster(getcharid(2)) != strcharinfo(0) ) goto L_not_gm;
    mes "[Guild Admin]";
    mes "Hello There it seems you are a Guild Master.";
    mes "On our server we have here a sytem called Guild Package.";
    next;
    mes "[Guild Admin]";
    mes "You will need 5 online members to your guild and includes you as of them.";
    mes "Or visit us on www.priam-ro.com/forum for more information about Guild Package.";
    next;
    mes "[Guild Admin]";
    mes "Do you want to claim it now and let me check your online players from your guild?";
    next;
    switch(select("Checking Requirements:Ready for claiming Guild Package:Maybe later..")) {
            case 1:
                mes "[Guild Admin]";
                mes "Checking...";
                set .@guild, getcharid(2);
                next;
                mes "[Guild Admin]";
                mes "Checking...";
                callsub OnCheck,1;
                next;
                mes "[Guild Admin]";
                mes "Your guild has a "+.@members+" members online with cleared IP Address in our database.";
                next;
                if(.@members < 5){
                mes "[Guild Admin]";
                mes "Sorry but your guild didn't reach the minimum amount of members needed.";
                set .@members,0;
                close;
                }
                mes "[Guild Admin]";
                mes "Your guild is qualified to apply Guild Package since you have "+.@members+" members online with cleared IP Address.";
                set .@members,0;
                close;
            case 2:
                mes "[Guild Admin]";
                mes "You will need at least 200 space to your storage or else.";
                mes "Do you want to proceed?";
                set .@guild, getcharid(2);
                next;
                switch(select("Yes:No")) {
                    case 1:
                        mes "[Guild Admin]";
                        mes "Processing....";

                        next;
                        mes "[Guild Admin]";
                        mes "Processing....";
                        callsub OnClaim,1;
                        next;
                        if(.@members < 5){
                        mes "[Guild Admin]";
                        mes "Sorry but some of the cleared IP Address are offline.";
                        set .@members,0;
                        close;
                        }
                        if (.@members < 10) {set .@greward,1;} // 5-9 Members
                        else if (.@members < 15) set .@greward,2; // 10-14 Members
                        else if (.@members < 20) set .@greward,3; // 15-19 Members
                        else if (.@members < 25) set .@greward,4; // 20-24 Members
                        else if (.@members < 30) set .@greward,5; // 25-29 Members
                        if (.@members == 30) {set .@greward,6;} // 30 Members

                        mes "[Guild Admin]";
                        mes "All items are stored to your storage please check.";
                        //Item List
                        storeitem 14004,(10*.@greward);                //10x Poison Bottle Box
                        storeitem 13995,(15*.@greward);                //15x Speed Potion Box        
                        storeitem 14003,(50*.@greward);                //50x Elite Siege Box
                        storeitem 13989,(50*.@greward);                //50x Acid Bomb Box
                        storeitem 5808,(1*.@greward);                //1x Dark Bacillium [1]
                        storeitem2 5170,(4*.@greward),1,6,0,0,0,0,0;    //4x +6 Feather Beret
                        storeitem2 2424,(4*.@greward),1,6,0,0,0,0,0;    //4x +6 Tidal Shoes [1]
                        storeitem2 2528,(4*.@greward),1,6,0,0,0,0,0;    //4x +6 Wool Scarf [1]
                        storeitem 2701,(4*.@greward);                //4x Orleans Glove [1]
                        storeitem 2729,(4*.@greward);                //4x Diablos Ring [1]
                        storeitem 2375,(1*.@greward);                //1x Diablos Armor [1]
                        storeitem 2374,(1*.@greward);                //1x Diablos Robe [1]
                        storeitem 2357,(1*.@greward);                //1x Valkyrian Armor [1]
                        storeitem 2115,(1*.@greward);                //1x Valkyrian Shield [1]
                        set #Claimed, 1;
                        set .@members,0;
                        set .@greward,0;
                        close;
                    case 2:
                        mes "[Guild Admin]";
                        mes "^616D7ENevermind~, You can come back again!";
                        close;
                        }end;



            case 3:
                mes "[Guild Admin]";
                mes "^616D7ENevermind~, You can come back again!";
                close;
        }end;

L_AG:
    mes "[Guild Admin]";
    mes "^616D7EYour already given a package.";
    close;
L_not_gm:
    mes "[Guild Admin]";
    mes "Ask your guild master to see me.";
    close;



OnCheck:

                for(set .@i,0; .@i<30; set .@i,.@i+1)
                deletearray .@acc[0], getarraysize(.@acc); deletearray .@char[0], getarraysize(.@char);
                query_sql("SELECT account_id,char_id FROM `guild_member` WHERE guild_id = '"+.@guild+"'", .@acc, .@char);
                for(set .@j,0; .@j<getarraysize(.@acc); set .@j,.@j+1)
                    if (isloggedin(.@acc[.@j],.@char[.@j])) {
                    query_sql("SELECT last_ip FROM `guild_member` WHERE account_id = '"+.@acc[.@j]+"'",.@ip1);
                    query_sql("SELECT last_ip FROM `guild_package` WHERE account_id = '"+.@acc[.@j]+"'",.@ip2);
                    if(.@ip1 == .@ip2) {
                    message rid2name(.@acc[.@j]),"Sorry but you can't use cheating on this system.";
                sleep 1;
                return;
                    }
                set .@members,.@members+1;                
                sleep 1;}
                return;


OnClaim:

                for(set .@i,0; .@i<30; set .@i,.@i+1)
                deletearray .@acc[0], getarraysize(.@acc); deletearray .@char[0], getarraysize(.@char);
                query_sql("SELECT account_id,char_id FROM `guild_member` WHERE guild_id = '"+.@guild+"'", .@acc, .@char);
                for(set .@j,0; .@j<getarraysize(.@acc); set .@j,.@j+1)
                    if (isloggedin(.@acc[.@j],.@char[.@j])) {
                    query_sql("SELECT last_ip FROM `guild_member` WHERE account_id = '"+.@acc[.@j]+"'",.@ip1);
                    query_sql("SELECT last_ip FROM `guild_package` WHERE account_id = '"+.@acc[.@j]+"'",.@ip2);
                    if(.@ip1 == .@ip2) {
                    message rid2name(.@acc[.@j]),"Sorry but you can't use cheating on this system.";
                sleep 1;
                return;
                    }
                    query_sql("INSERT INTO `guild_package` (NULL,'account_id' , 'last_ip') VALUES ('.@acc[.@j]','.@ip1')");    
                set .@members,.@members+1;                    
                sleep 1;}
                return;


            
}

This script is working but... I think I just have a problem in OnClaim and OnCheck.. anyone can check this script?

Edited by Nasagnilac
Link to comment
Share on other sites

9 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

Try this :

- query_sql "INSERT INTO `guild_package` (NULL,`account_id` , `last_ip`) VALUES (NULL,'"+.@acc[.@j]+"','"+.@ip1+"')";
+ query_sql "INSERT INTO `guild_package` (`account_id` , `last_ip`) VALUES ('"+.@acc[.@j]+"','"+.@ip1+"')"; 
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   0
  • Joined:  02/20/12
  • Last Seen:  

bump

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

Well, i'm not 100% sure since I don't know what errors your getting, in regards to it not working but for both OnCheck and OnClaim try changing sleep 1   INTO   sleep2 1

That's what I'm speculating right now at least.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  89
  • Topics Per Day:  0.02
  • Content Count:  232
  • Reputation:   15
  • Joined:  11/02/13
  • Last Seen:  

prontera,153,164,4	script	Guild Admin	88,{

	setarray .@Gitem[0],   14003, 14003, 14003, 14003;
	setarray .@GAmount[0],     1,     1,     1,     1;

    if(#Claimed == 1) goto L_AG;
    if ( getguildmaster(getcharid(2)) != strcharinfo(0) ) goto L_not_gm;
    mes "[Guild Admin]";
    mes "Hello There it seems you are a Guild Master.";
    mes "On our server we have here a sytem called Guild Package.";
    next;
    mes "[Guild Admin]";
    mes "You will need 5 online members to your guild and includes you as of them.";
    next;
    mes "[Guild Admin]";
    mes "Do you want to claim it now and let me check your online players from your guild?";
    next;
    switch(select("Checking Requirements:Ready for claiming Guild Package:Maybe later..")) {
            case 1:
                mes "[Guild Admin]";
                mes "Checking...";
                set .@guild, getcharid(2);
                next;
                mes "[Guild Admin]";
                mes "Checking...";
                callsub OnCheck,1;
                next;
                mes "[Guild Admin]";
                mes "Your guild has a "+.@members+" members online with cleared IP Address in our database.";
                next;
                if(@members < 5){
                mes "[Guild Admin]";
                mes "Sorry but your guild didn't reach the minimum amount of members needed.";
                set @members,0;
                close;
                }
                mes "[Guild Admin]";
                mes "Your guild is qualified to apply Guild Package since you have "+.@members+" members online with cleared IP Address.";
                set @members,0;
                close;
            case 2:
                mes "[Guild Admin]";
                mes "You will need at least 200 space to your storage or else.";
                mes "Do you want to proceed?";
                set .@guild, getcharid(2);
                next;
                switch(select("Yes:No")) {
                    case 1:
                        mes "[Guild Admin]";
                        mes "Processing....";

                        next;
                        mes "[Guild Admin]";
                        mes "Processing....";
                        callsub OnClaim,1;
                        next;
                        if(@members < 5){
                        mes "[Guild Admin]";
                        mes "Sorry but some of the cleared IP Address are offline.";
                        set @members,0;
                        close;
                        }
                        if (.@members <= 5) {set .@greward,1;} // 5-9 Members
                        else if (@members <= 10){set .@greward,2;} // 10-14 Members
                        else if (@members < 15){set .@greward,3;} // 15-19 Members
                        else if (@members < 20){set .@greward,4;} // 20-24 Members
                        else if (@members <= 25){set .@greward,5;} // 25-29 Members
                        mes "[Guild Admin]";
                        mes "Processing....";
                        next;
                        mes "[Guild Admin]";
                        mes "All items are stored to your storage please check.";
               					 //////////Item List//////////
				for( set .@i, 0; .@i < getarraysize(.@Gitem); set .@i, .@i + 1 ){
					storeitem .@Gitem[.@i],(.@GAmount[.@i]*.@greward);
				}
					set #Claimed, 1;
					set @members,0;
					set .@greward,0;
				close;			

                    case 2:
                        mes "[Guild Admin]";
                        mes "^616D7ENevermind~, You can come back again!";
                        close;
                        }



            case 3:
                mes "[Guild Admin]";
                mes "^616D7ENevermind~, You can come back again!";
                close;
        }

L_AG:
    mes "[Guild Admin]";
    mes "^616D7EYour already given a package.";
    close;
L_not_gm:
    mes "[Guild Admin]";
    mes "Ask your guild master to see me.";
    close;


OnCheck:
	for(set .@i,0; .@i<25; set .@i,.@i+1)
		query_sql("SELECT account_id,char_id FROM `guild_member` WHERE guild_id = '"+.@guild+"'", .@acc, .@char);
		for(set .@j,0; .@j<getarraysize(.@acc); set .@j,.@j+1)
			if (isloggedin(.@acc[.@j],.@char[.@j])) {
				query_sql("SELECT last_ip FROM `guild_member` WHERE account_id = '"+.@acc[.@j]+"'",.@ip1);
				query_sql("SELECT last_ip FROM `guild_package` WHERE account_id = '"+.@acc[.@j]+"'",.@ip2);
				goto IP_Check1;
				}
				return;

IP_Check1:
				if(.@ip1 == .@ip2){
				message rid2name(.@acc[.@j]),"Sorry but you can't cheat on this system.";
				}
				else{
				set @members,@members+1;  
				}
				end;


OnClaim:

	for(set .@i,0; .@i<25; set .@i,.@i+1)
		query_sql("SELECT account_id,char_id FROM `guild_member` WHERE guild_id = '"+.@guild+"'", .@acc, .@char);
                for(set .@j,0; .@j<getarraysize(.@acc); set .@j,.@j+1)
			if (isloggedin(.@acc[.@j],.@char[.@j])) {
				query_sql("SELECT last_ip FROM `guild_member` WHERE account_id = '"+.@acc[.@j]+"'",.@ip1);
				query_sql("SELECT last_ip FROM `guild_package` WHERE account_id = '"+.@acc[.@j]+"'",.@ip2);
				goto IP_Check2;                    
				}
				return;

IP_Check2:
				if(.@ip1 == .@ip2){
				message rid2name(.@acc[.@j]),"Sorry but you can't cheat on this system.";
				}
				else{
				query_sql("INSERT INTO `guild_package` (NULL,'account_id' , 'last_ip') VALUES (NULL,'.@acc[.@j]','.@ip1')");    
				set @members,@members+1;  
				}
				end;

}

Hi I just edit it but something happens... it always says that I just have 0 members,it dont counts me or maybe I got problem with @members. here is the image.post-21795-0-54273000-1384189255_thumb.jpg

 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

Don't use:  ' .@variables ' when in combination with callsub, it acts the same way as callfunc, meaning you can't pass scope variables (Atleast this has been my issue through testing). Replace those with a normal @variable, and see if that works. Because your problem could be that, your trying to pass the .@variables, and run a sql query, leading those variables to be reset to 0. Thus, it can't check against anything, resulting in your 0 players found.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  89
  • Topics Per Day:  0.02
  • Content Count:  232
  • Reputation:   15
  • Joined:  11/02/13
  • Last Seen:  

I got this problem....Im not too familiar with query_sql..post-21795-0-16501100-1384229049_thumb.jpg

 

here is the code..

			for(set .@i,0; .@i<25; set .@i,.@i+1)
				query_sql("SELECT account_id,char_id FROM `guild_member` WHERE guild_id = '"+.@guild+"'", .@acc, .@char);
				for(set .@j,0; .@j<getarraysize(.@acc); set .@j,.@j+1){
						query_sql("SELECT `last_ip` FROM `login` WHERE account_id = '"+.@acc[.@j]+"'",.@ip1);
					if (isloggedin(.@acc[.@j],.@char[.@j])) {
						query_sql("SELECT `last_ip` FROM `guild_package` WHERE `account_id` = '"+.@acc[.@j]+"' AND `last_ip` = '.@ip1+'",.@ip2);
				if(.@ip2){
				message rid2name(.@acc[.@j]),"Sorry but you can't cheat on this system.";
				}else{                 
				query_sql "INSERT INTO `guild_package` (NULL,`account_id` , `last_ip`) VALUES (NULL,'"+.@acc[.@j]+"','"+.@ip1+"')";  
				set $@members,$@members+1;  
					}
				}

 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  89
  • Topics Per Day:  0.02
  • Content Count:  232
  • Reputation:   15
  • Joined:  11/02/13
  • Last Seen:  

This topic is solved now... thank you for your help.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  7
  • Reputation:   0
  • Joined:  06/07/12
  • Last Seen:  

 query_sql "INSERT INTO `guild_package` (`account_id` , `last_ip`) VALUES ('"+.@acc[.@j]+"','"+.@ip1+"')";

i have same problem .. i try put this ... i see in ro have some .. dont have function ... can help ??

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.01
  • Content Count:  52
  • Reputation:   2
  • Joined:  02/15/14
  • Last Seen:  

Can someone provide me which one is the correct script, I saw 2 different edit and don't know which is the chosen working one. Especially about the On claim and On Check.

OnCheck:

                for(set .@i,0; .@i<30; set .@i,.@i+1)
                deletearray .@acc[0], getarraysize(.@acc); deletearray .@char[0], getarraysize(.@char);
                query_sql("SELECT account_id,char_id FROM `guild_member` WHERE guild_id = '"+.@guild+"'", .@acc, .@char);
                for(set .@j,0; .@j<getarraysize(.@acc); set .@j,.@j+1)
                    if (isloggedin(.@acc[.@j],.@char[.@j])) {
                    query_sql("SELECT last_ip FROM `guild_member` WHERE account_id = '"+.@acc[.@j]+"'",.@ip1);
                    query_sql("SELECT last_ip FROM `guild_package` WHERE account_id = '"+.@acc[.@j]+"'",.@ip2);
                    if(.@ip1 == .@ip2) {
                    message rid2name(.@acc[.@j]),"Sorry but you can't use cheating on this system.";
                sleep 1;
                return;
                    }
                set .@members,.@members+1;                
                sleep 1;}
                return;


OnClaim:

                for(set .@i,0; .@i<30; set .@i,.@i+1)
                deletearray .@acc[0], getarraysize(.@acc); deletearray .@char[0], getarraysize(.@char);
                query_sql("SELECT account_id,char_id FROM `guild_member` WHERE guild_id = '"+.@guild+"'", .@acc, .@char);
                for(set .@j,0; .@j<getarraysize(.@acc); set .@j,.@j+1)
                    if (isloggedin(.@acc[.@j],.@char[.@j])) {
                    query_sql("SELECT last_ip FROM `guild_member` WHERE account_id = '"+.@acc[.@j]+"'",.@ip1);
                    query_sql("SELECT last_ip FROM `guild_package` WHERE account_id = '"+.@acc[.@j]+"'",.@ip2);
                    if(.@ip1 == .@ip2) {
                    message rid2name(.@acc[.@j]),"Sorry but you can't use cheating on this system.";
                sleep 1;
                return;
                    }
                    query_sql("INSERT INTO `guild_package` (NULL,'account_id' , 'last_ip') VALUES ('.@acc[.@j]','.@ip1')");    
                set .@members,.@members+1;                    
                sleep 1;}
                return;


            
}

the other edited one

OnCheck:
	for(set .@i,0; .@i<25; set .@i,.@i+1)
		query_sql("SELECT account_id,char_id FROM `guild_member` WHERE guild_id = '"+.@guild+"'", .@acc, .@char);
		for(set .@j,0; .@j<getarraysize(.@acc); set .@j,.@j+1)
			if (isloggedin(.@acc[.@j],.@char[.@j])) {
				query_sql("SELECT last_ip FROM `guild_member` WHERE account_id = '"+.@acc[.@j]+"'",.@ip1);
				query_sql("SELECT last_ip FROM `guild_package` WHERE account_id = '"+.@acc[.@j]+"'",.@ip2);
				goto IP_Check1;
				}
				return;

IP_Check1:
				if(.@ip1 == .@ip2){
				message rid2name(.@acc[.@j]),"Sorry but you can't cheat on this system.";
				}
				else{
				set @members,@members+1;  
				}
				end;


OnClaim:

	for(set .@i,0; .@i<25; set .@i,.@i+1)
		query_sql("SELECT account_id,char_id FROM `guild_member` WHERE guild_id = '"+.@guild+"'", .@acc, .@char);
                for(set .@j,0; .@j<getarraysize(.@acc); set .@j,.@j+1)
			if (isloggedin(.@acc[.@j],.@char[.@j])) {
				query_sql("SELECT last_ip FROM `guild_member` WHERE account_id = '"+.@acc[.@j]+"'",.@ip1);
				query_sql("SELECT last_ip FROM `guild_package` WHERE account_id = '"+.@acc[.@j]+"'",.@ip2);
				goto IP_Check2;                    
				}
				return;

IP_Check2:
				if(.@ip1 == .@ip2){
				message rid2name(.@acc[.@j]),"Sorry but you can't cheat on this system.";
				}
				else{
				query_sql("INSERT INTO `guild_package` (NULL,'account_id' , 'last_ip') VALUES (NULL,'.@acc[.@j]','.@ip1')");    
				set @members,@members+1;  
				}
				end;

}

Someone please tell me which one is the error bug free one, sorry if its too much, if possible please post the full script here yea. Thanks in advance.

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