Advertisement
Guest User

Points Giver

a guest
Nov 26th, 2011
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. new_1-1,55,102,5 script MyCharCurrencyVal 431,{
  2. // Variable-name to set
  3. set(.@varToSet$, "#MYAccCurrencyVal"); // May be also string
  4.  
  5. mes("Player name:");
  6. input(.@name$);
  7. next;
  8. mes("New value:");
  9. input(.@val$);
  10.  
  11. // Check if player is online
  12. if (set(.@id, getCharID(3, .@name$))) {
  13. // Player online, attach it
  14. close2();
  15. attachRID(.@id);
  16. setD(.@varToSet$, (atoi(.@val$) ? atoi(.@val$) : .@val$));
  17. detachRID();
  18. end;
  19. } else {
  20. // Player offline, query it
  21. query_Sql("SELECT `char_id` FROM `char` WHERE `name` = '" + .@name$ + "' LIMIT 1", .@charID);
  22. if (.@charID) {
  23. // Player found, update value
  24. query_Sql("UPDATE global_reg_value SET value = '" + .@val$ + "' WHERE char_id = '" + .@charID + "'");
  25. } else {
  26. // TILT - player not found, maybe typo
  27. mes("Failed to find player \"" + .@name$ + "\" in out database.");
  28. }
  29. }
  30. close();
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement