Advertisement
Guest User

PK Title

a guest
Jun 23rd, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.85 KB | None | 0 0
  1. //
  2. // Author Goddameit
  3. // Version 2013/12/03
  4. // Web__ http://goo.gl/igS14r
  5. //
  6. - script GD_PK_TITLE -1,{
  7. function SETTILE ;
  8. function GETTILE {
  9. switch(getarg(0,0))
  10. {
  11. case 1: return "[MVP]";
  12. default: return "";
  13. }
  14. }
  15. OnPCLoginEvent:
  16. for(set .@i,0; .@i<.SP_RANK; set .@i,.@i+1 )
  17. {
  18. if( getcharid(0) == .SP_RN_CID[.@i] )
  19. {
  20. set .@N$,GETTILE(.@i+1);
  21. if( .@N$ != "" )
  22. {
  23. atcommand "@fakename "+.@N$+""+strcharinfo(0);
  24. set @PK_TITL_BOOL,1;
  25. }
  26. break;
  27. }
  28. }
  29. end;
  30. OnPCKillEvent:
  31. if( killedrid == getcharid(3) || !isloggedin(killedrid) )
  32. end;
  33. set @GDCID,getcharid(0);
  34. query_sql "SELECT `char_id` FROM `GD_PK_TITLE` WHERE `char_id` = "+@GDCID+"",@GDTID;
  35. if( !@GDTID )
  36. query_sql "INSERT `GD_PK_TITLE` VALUES("+@GDCID+",1)";
  37. else
  38. query_sql "UPDATE `GD_PK_TITLE` SET `var` = `var`+1 WHERE `char_id` = "+@GDCID+"";
  39. set @GDTID,0;
  40. set @GDCID,0;
  41. end;
  42. OnInit:
  43. bindatcmd "delpktitle","GD_PK_TITLE::OnGMFActive1",99,99,0;
  44. bindatcmd "refhpktile","GD_PK_TITLE::OnGMFActive3",99,99,0;
  45. set .SP_RANK,2;
  46. OnGMFActive3:
  47. if( playerattached() )
  48. {
  49. dispbottom "All date was refresh.";
  50. detachrid;
  51. }
  52. OnTimer60000:
  53. stopnpctimer;
  54. deletearray .TMP_SP_RN_CID[0],128;
  55. query_sql "SELECT `char_id` FROM `GD_PK_TITLE` ORDER BY `var` DESC LIMIT "+.SP_RANK,.TMP_SP_RN_CID;
  56. SETTILE(0);
  57. deletearray .SP_RN_CID[0],128;
  58. deletearray .SP_RN_VAR[0],128;
  59. query_sql "SELECT `char_id`,`var` FROM `GD_PK_TITLE` ORDER BY `var` DESC LIMIT "+.SP_RANK,.SP_RN_CID,.SP_RN_VAR;
  60. SETTILE(1);
  61. deletearray .TMP_SP_RN_CID[0],128;
  62. initnpctimer;
  63. end;
  64. OnGMFActive1:
  65. query_sql "TRUNCATE TABLE `GD_PK_TITLE`";
  66. dispbottom "All date was cleaned.";
  67. end;
  68. function SETTILE {
  69. for(set .@i,0; .@i<.SP_RANK; set .@i,.@i+1 )
  70. {
  71. query_sql "SELECT `account_id` FROM `char` WHERE `char_id` = "+.SP_RN_CID[.@i]+"",.@SP_RN_AID;
  72. if( attachrid(.@SP_RN_AID) )
  73. {
  74. if( .TMP_SP_RN_CID[.@i] == .SP_RN_CID[.@i] && @PK_TITL_BOOL )
  75. {
  76. detachrid;
  77. continue;
  78. }
  79. if( getarg(0,0) == 1 )
  80. {
  81. set .@N$,GETTILE(.@i+1);
  82. if( .@N$ != "" )
  83. {
  84. atcommand "@fakename "+.@N$+""+strcharinfo(0);
  85. set @PK_TITL_BOOL,1;
  86. }
  87. }else
  88. if( @PK_TITL_BOOL )
  89. {
  90. atcommand "@fakename";
  91. set @PK_TITL_BOOL,0;
  92. }
  93. detachrid;
  94. }
  95. }
  96. return;
  97. }
  98. }
  99. prontera,150,180,4 script Rank 4_M_TUFFOLD,{
  100. mes "[Rank]";
  101. set .@SP_RANK,getvariableofnpc(.SP_RANK,"GD_PK_TITLE");
  102. for(set .@i,0; .@i<.@SP_RANK; set .@i,.@i+1 )
  103. {
  104. set .@SP_RN_CID,getvariableofnpc(.SP_RN_CID[.@i],"GD_PK_TITLE");
  105. set .@SP_RN_VAR,getvariableofnpc(.SP_RN_VAR[.@i],"GD_PK_TITLE");
  106. if( !.@SP_RN_CID || !.@SP_RN_VAR )
  107. break;
  108. query_sql "SELECT `name` FROM `char` WHERE `char_id` = "+.@SP_RN_CID+"",.@SP_RN_NAME$;
  109. mes "[#"+(.@i+1)+"] "+.@SP_RN_NAME$+" "+.@SP_RN_VAR+"p";
  110. }
  111. close;
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement