Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- new_1-1,55,102,5 script MyCharCurrencyVal 431,{
- // Variable-name to set
- set(.@varToSet$, "#MYAccCurrencyVal"); // May be also string
- mes("Player name:");
- input(.@name$);
- next;
- mes("New value:");
- input(.@val$);
- // Check if player is online
- if (set(.@id, getCharID(3, .@name$))) {
- // Player online, attach it
- close2();
- attachRID(.@id);
- setD(.@varToSet$, (atoi(.@val$) ? atoi(.@val$) : .@val$));
- detachRID();
- end;
- } else {
- // Player offline, query it
- query_Sql("SELECT `char_id` FROM `char` WHERE `name` = '" + .@name$ + "' LIMIT 1", .@charID);
- if (.@charID) {
- // Player found, update value
- query_Sql("UPDATE global_reg_value SET value = '" + .@val$ + "' WHERE char_id = '" + .@charID + "'");
- } else {
- // TILT - player not found, maybe typo
- mes("Failed to find player \"" + .@name$ + "\" in out database.");
- }
- }
- close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement