Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ---
- //= Script administrador de Cash Points v1.0 [Rokimoki]
- // * Only SQL eAthena Version (trunk/stable)
- // * Add Cash Points
- // * Delete Cash Points
- // * Search Cash Points
- // * Only for Admins
- // * Password system in the script (Search "putyourpasswordhere" and modify the password)
- // * Notify if your cashpoint amount was changed, added/deleted and who changed (the guy who used this script) only if you are online when cash point was changed
- // * Notify if your cashpoint amount was changed when you was offline, if deleted or added but don't show who modified
- // * Log System, Store in your DB (SQL DB or TXT DB) User, Account ID, Cash Ammound (added or deleted), Affected Account ID in that cases:
- // -> If a GM input a wrong password
- // -> If a GM add/delete Cash Points to someone
- // ---
- //= Script works if the user affected is online or not
- // If online not SQL method, if offline SQL method, no need to relog game if online
- // ---
- - script Cashpoint -1,{
- OnWhisperGlobal:
- if (getgmlevel() < 99) { // If not admin shows cash point ammount
- dispbottom "Tu cantidad de cash points es: " +#CASHPOINTS;
- end;
- } // End if
- if (@whispervar0$ != "Cash") { // Password line
- logmes "User: " +strcharinfo(0) +" with account id: " +getcharid(3) +" has inserted a wrong pasword in SQL Manager NPC, he wrote: " +@whispervar0$; // PAWN!
- end;
- } // End if
- deletearray .@array$[0], 128; // Debug
- deletearray .@idcuenta[0], 128;
- set .@nombre$, "[^0000FFCash Point Assistant^000000]";
- mes .@nombre$;
- mes "Hello I'm the Cash Point Manager, choose what you want...";
- next;
- switch (select("Add Cash Points:Delete Cash Points:Search Cash Points:Exit")) {
- case 1: // Add cash points
- callfunc("CashPoints",1);
- break;
- case 2: // Delete cash points
- callfunc("CashPoints",2);
- break;
- case 3: // Search cash points
- callfunc("CashPoints",3);
- break;
- case 4: // Exit
- mes "Bye bye...";
- break;
- } // End switch
- close;
- OnPCLoginEvent: // Offline Notify
- if (#CASHPOINTS > UltimoCash) dispbottom "Hi, some admin has added some cash points to your account, actual balance: " +#CASHPOINTS +", before: " +UltimoCash;
- set UltimoCash, #CASHPOINTS;
- end;
- } // End Script
- function script CashPoints {
- mes .@nombre$;
- mes "I need to know something first...";
- next;
- mes .@nombre$;
- if (select("Input character name:Input login account name") == 1) {
- mes "Input character name: ";
- next;
- input .@nombre$;
- query_sql "SELECT `account_id` FROM `char` WHERE `name` = '" +escape_sql(.@nombre$) +"'", .@idcuenta[0];
- } else {
- mes "Input login account name: ";
- next;
- input .@login$;
- query_sql "SELECT `account_id` FROM `login` WHERE `userid` = '" +escape_sql(.@login$) +"'", .@idcuenta[0];
- } // End if
- if (!.@idcuenta[0]) {
- mes "I'm sorry but I can't find anything with that datum you gave me, try again.";
- close;
- } // End if
- if (getarg(0) == 3) {
- if (isloggedin(.@idcuenta[0])) { // If online
- // Store GM data
- set .@gm$, strcharinfo(0);
- set .@id, getcharid(3);
- detachrid;
- // Attach user who will recieve cash points
- attachrid(.@idcuenta[0]);
- set .@cash, #CASHPOINTS; // Store current cash points
- detachrid;
- attachrid(.@id);
- mes .@nombre$;
- mes "User searched has in his account: ^FF0000" +.@cash +"^000000 Cash Points.";
- } else { // Si está Offline
- query_sql "SELECT `value` FROM global_reg_value WHERE `str` = '#CASHPOINTS' and account_id = " +.@idcuenta[0], .@valor[0]; // Store how many Cash Points
- if (!.@valor[0]) mes "That user has no Cash Point in his account."; // If he has Cash Points
- else mes "The user has ^FF0000" +.@valor[0] +"^000000 Cash Points in his account."; // If he hasn't Cash Points
- } // End if
- close;
- } // End if
- mes .@nombre$;
- mes "Now input the Cash Point amount: ";
- next;
- input .@cantidad, -1000000, 1000000; // Debug
- if (.@cantidad < 1 || .@cantidad > 1000000) { // Define here the max cash point value per use
- mes .@nombre$;
- mes "You have to input a valid value, must be positive number and lower than ^FF00001000000^000000 to avoid abuse."; // Modify number here
- close;
- } // End if
- if (isloggedin(.@idcuenta[0])) { // If online
- // Store GM data
- set .@gm$, strcharinfo(0);
- set .@id, getcharid(3);
- detachrid;
- // Attach user who will recieve cash points
- attachrid(.@idcuenta[0]);
- set .@cash, #CASHPOINTS; // Store current cash points
- if (getarg(0) == 1) {
- set #CASHPOINTS, #CASHPOINTS + .@cantidad; // Add cash points, map-server will do that
- dispbottom "The Admin [" + .@gm$ +"] has added you: " +.@cantidad +" cash points in your account, current cash points: " +#CASHPOINTS; // Online Notify
- } else if (getarg(0) == 2) {
- if (.@cash <= 0) {
- detachrid;
- attachrid(.@id);
- mes .@nombre$;
- mes "I'm sorry but you can't delete any cash point because he has no cash point in his account.";
- close;
- } else if (.@cash - .@cantidad < 0) {
- detachrid;
- attachrid(.@id);
- mes .@nombre$;
- mes "Sorry but you tried to delete so many cash points, you probably put his cash points to negative numbers, you only can delete ^FF0000" +.@cash +"^000000 cash points.";
- close;
- } // End if
- set #CASHPOINTS, #CASHPOINTS - .@cantidad; // Delete cash points, map-server will do that
- dispbottom "The Admin [" + .@gm$ +"] has deleted you: " +.@cantidad +" cash points in your account, current cash points: " +#CASHPOINTS; // Online Notify
- set .@accion, 1; // Semaphore
- } // End if
- detachrid;
- attachrid(.@id);
- } else { // If not online
- query_sql "SELECT `str` FROM global_reg_value WHERE account_id = " +.@idcuenta[0], .@array$[0]; // Check if he has any cash points
- if (.@array$[0] != "#CASHPOINTS") { // He has no cash points
- if (getarg(0) == 1) {
- query_sql "INSERT INTO `global_reg_value` (`char_id`,`str`,`value`,`type`,`account_id`) VALUES ('0','#CASHPOINTS','" +.@cantidad +"','2','" +.@idcuenta[0] +"')"; // Create SQL cash points
- } else {
- mes .@nombre$;
- mes "Sorry but you can't delete cash points since he has not.";
- close;
- } // End if
- } else { // He has cash points
- if (getarg(0) == 1) {
- query_sql "UPDATE global_reg_value SET `value` = `value` + '" +.@cantidad +"' WHERE `str` = '#CASHPOINTS' and account_id = '" +.@idcuenta[0] +"'"; // Update cash points value
- } else if (getarg(0) == 2) {
- query_sql "SELECT `value` FROM global_reg_value WHERE `str` = '#CASHPOINTS' and account_id = " +.@idcuenta[0], .@valor[0]; // Store cash points value
- mes .@nombre$;
- if (.@valor[0] <= 0) {
- mes "Sorry but you can't delete cash points since he has not.";
- close;
- } else if (.@valor[0] - .@cantidad < 0) {
- mes "Sorry but you tried to delete so many cash points, you probably put his cash points to negative numbers, you only can delete ^FF0000" +.@valor[0] +"^000000 cash points.";
- close;
- } // End if
- query_sql "UPDATE global_reg_value SET `value` = `value` - '" +.@cantidad +"' WHERE `str` = '#CASHPOINTS' and account_id = '" +.@idcuenta[0] +"'";
- set .@accion, 1; // Semaphore
- } // End if
- } // End if
- } // End if
- // Store LOGs
- if (!.@accion) logmes "The user: " +strcharinfo(0) +" with account id: " +getcharid(3) +" has added " +.@cantidad +" Cash Points to the account ID: " +.@idcuenta[0];
- else logmes "The user: " +strcharinfo(0) +" with account id: " +getcharid(3) +" has deleted " +.@cantidad +" Cash Points to the account ID: " +.@idcuenta[0];
- mes "The Cash Points was modified, thanks for using this servide made by ^FF0000Admin of Fullguard^000000 from eAthena forums.";
- return;
- } // End function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement