Jump to content
  • 0
Sign in to follow this  
Hyoru

Cash Point Giver

Question

This script isn't work.

 

prontera,156,178,4	script	ChangeMe	910,{	if (getgmlevel() < 10) end;	set .@AID, getcharid(3);	// save their RID		mes "Hello GM";	mes "Enter the char's name:";	input .@name$;	query_sql "SELECT `account_id`,`name` FROM `char` WHERE `name` = '"+escape_sql(.@name$)+"'", .@account_id,.@name$;	if (!.@account_id) {		mes "^FF0000     This player doesn't exist!";		close;	}	mes "How many cash point would you like give to^0000FF " + .@name$ + "^000000?";	input .@amt;	if (.@amt < 1) {		mes "^FF0000     Amount must be positive.";		close;	}		mes " ";	mes "Give "+.@amt+" cash points to "+.@name$+"?";	if(select("Yes:No")==2) close;		if (attachrid(.@account_id)) {		set #CASHPOINTS, #CASHPOINTS + .@amt;		dispbottom "Gained "+.@amt+" cash points. Total "+#CASHPOINTS+" points";	} else {		query_sql "SELECT COUNT(`account_id`) FROM `global_reg_value` WHERE `str`='#CASHPOINTS' AND `account_id`='"+.@account_id+"'", .@update;		if (.@update)			query_sql "UPDATE `global_reg_value` SET `value` = (CAST(`value` AS UNSIGNED)+'"+.@amt+"') WHERE `str`='#CASHPOINTS' AND `account_id`='"+.@account_id+"'";		else			query_sql "INSERT INTO `global_reg_value` (`str`,`value`,`type`,`account_id`) VALUES ('#CASHPOINTS',"+.@amt+",2,"+.@account_id+")";	}	attachrid(.@AID);	mes "Gave "+.@amt+" cash points to "+.@name$+".";	close;}

It add CASH to players even if they're offline.

 

I tried to change 'global_reg_value' to 'acc_reg_num_db' but didnt work.

 

Thanks in advanced.

Edited by hyoru

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

 

I tried to change 'global_reg_value' to 'acc_reg_num_db' but didnt work.

Did you also changed str to key? eg

 

 

query_sql "SELECT COUNT(`account_id`) FROM `global_reg_value` WHERE `str`='#CASHPOINTS' AND `account_id`='"+.@account_id+"'", .@update; 

to

 

query_sql "SELECT COUNT(`account_id`) FROM `acc_reg_num_db` WHERE `key`='#CASHPOINTS' AND `account_id`='"+.@account_id+"'", .@update;

You also need to do those changes in other sql commands

 

and probably other stuffs like "type" in

 

query_sql "INSERT INTO `global_reg_value` (`str`,`value`,`type`,`account_id` 

cause acc_reg_num_db doesn't have the type in structure its not needed anymore.

Edited by Happy

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.