Advertisement
Guest User

Custom Functions - Kapersky

a guest
Mar 1st, 2015
745
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.29 KB | None | 0 0
  1. /* Custom Functions */
  2. public OnPlayerAccountCheck(playerid)
  3. {
  4. new rows, fields;
  5. new dialogstring[300];
  6. cache_get_data( rows, fields, mysql );
  7. if( rows )
  8. {
  9. cache_get_field_content(0, "Password", pInfo[playerid][Password], mysql, 129);
  10. pInfo[playerid][ID] = cache_get_field_content_int(0, "ID");
  11. format( dialogstring, sizeof( dialogstring ), "Welcome back to "SERVER_NAME", {00FF00}%s!\nPlease enter your password below to login.", Name[playerid]);
  12. ShowPlayerDialog(playerid, D_LOG, DIALOG_STYLE_PASSWORD, "Welcome back to CVT!", dialogstring, "Login", "Quit");
  13. }
  14. else
  15. {
  16. format( dialogstring, sizeof( dialogstring ), "Welcome to "SERVER_NAME", {00FF00}%s!\nPlease enter a password below to register.", Name[playerid]);
  17. ShowPlayerDialog(playerid, D_REG, DIALOG_STYLE_PASSWORD, "Welcome to CVT!", dialogstring, "Register", "Quit");
  18. }
  19. return 1;
  20. }
  21.  
  22. public OnPlayerAccountRegister(playerid)
  23. {
  24. pInfo[playerid][ID] = cache_insert_id();
  25. gIsNewHere { playerid } = true;
  26. SpawnPlayer(playerid);
  27. return 1;
  28. }
  29.  
  30. public OnPlayerAccountLoad(playerid)
  31. {
  32. pInfo[playerid][Admin] = cache_get_field_content_int(0, "Admin");
  33. pInfo[playerid][VIP] = cache_get_field_content_int(0, "VIP");
  34. pInfo[playerid][Money] = cache_get_field_content_int(0, "Money");
  35. pInfo[playerid][Team] = cache_get_field_content_int(0, "Team");
  36.  
  37. GivePlayerMoney(playerid, pInfo[playerid][Money]);
  38. SendClientMessage(playerid, -1, "Successfully logged in!");
  39. return 1;
  40. }
  41.  
  42. stock KickEx(playerid)
  43. {
  44. SetTimerEx("KickPlayer", 1000, false, "i", playerid);
  45. return 1;
  46. }
  47.  
  48. public KickPlayer(playerid)
  49. {
  50. Kick(playerid);
  51. return 1;
  52. }
  53.  
  54. public SaveAccountsPerMinute(playerid)
  55. {
  56. SaveAccounts(playerid);
  57. return 1;
  58. }
  59.  
  60. SaveAccounts(playerid)
  61. {
  62. new query[300];
  63. mysql_format(mysql, query, sizeof(query), "UPDATE `players` SET `Admin`='%d', `Money`='%d', `VIP`='%d', `Team`='%d' WHERE `ID`='%d'", \
  64. pInfo[playerid][Admin],
  65. pInfo[playerid][Money],
  66. pInfo[playerid][VIP],
  67. pInfo[playerid][Team],
  68. pInfo[playerid][ID]);
  69. mysql_tquery(mysql, query, "", "");
  70. return 1;
  71. }
  72.  
  73. stock SkinSelectionPerTeam(playerid)
  74. {
  75. if(pInfo[playerid][Team] == 1) //Is a cop
  76. {
  77. new SkinArray[9];
  78. SkinArray[0] = 287;
  79. SkinArray[1] = 280;
  80. SkinArray[2] = 282;
  81. SkinArray[3] = 285;
  82. SkinArray[4] = 284;
  83. SkinArray[5] = 267;
  84. SkinArray[6] = 266;
  85. SkinArray[7] = 265;
  86. ShowModelSelectionMenuEx(playerid, SkinArray, 8, "Select Skin", CUSTOM_SKIN_ARMY_MENU, 16.0, 0.0, -55.0, 1, 0x464646FF, 0x88888899 , 0xFFFF00AA);
  87. return 1;
  88. }
  89. else if(pInfo[playerid][Team] == 2) //Is a terrorist
  90. {
  91. new SkinArray[9];
  92. SkinArray[0] = 254;
  93. SkinArray[1] = 248;
  94. SkinArray[2] = 241;
  95. SkinArray[3] = 217;
  96. SkinArray[4] = 179;
  97. SkinArray[5] = 176;
  98. ShowModelSelectionMenuEx(playerid, SkinArray, 6, "Select Skin", CUSTOM_SKIN_TERROR_MENU, 16.0, 0.0, -55.0, 1, 0x464646FF, 0x88888899 , 0xFFFF00AA);
  99. return 1;
  100. }
  101. return 1;
  102. }
  103.  
  104. public AntiSpawnTimer(playerid)
  105. {
  106. SetPlayerHealthEx(playerid, 80);
  107. gAntiSpawnProtected{ playerid } = false;
  108. SendClientMessage(playerid, COLOR_RED, "* Your anti spawn-kill protection has been ended.");
  109. return 1;
  110. }
  111.  
  112. public Anticheat(playerid)
  113. {
  114. if(GetPlayerHealthEx(playerid) != gHealth[playerid])
  115. {
  116. SetPlayerHealthEx(playerid, gHealth[playerid]);
  117. }
  118. if(GetPlayerArmourEx(playerid) != gArmour[playerid])
  119. {
  120. SetPlayerHealthEx(playerid, gArmour[playerid]);
  121. }
  122. return 1;
  123. }
  124.  
  125. public OnPlayerModelSelectionEx(playerid, response, extraid, modelid)
  126. {
  127. if(extraid == CUSTOM_SKIN_ARMY_MENU || CUSTOM_SKIN_TERROR_MENU)
  128. {
  129. if(response)
  130. {
  131. SendClientMessage(playerid, COLOR_RED, "Skin selected. You are ready for the war!");
  132. SetPlayerSkin(playerid, modelid);
  133. GivePlayerWeapon(playerid, WEAPON_DEAGLE, 150);
  134. GivePlayerWeapon(playerid, WEAPON_SHOTGUN, random(150));
  135. GivePlayerWeapon(playerid, WEAPON_AK47, random(500));
  136. GivePlayerWeapon(playerid, WEAPON_MP5, random(500));
  137. GivePlayerWeapon(playerid, WEAPON_RIFLE, random(200));
  138. SendClientMessage(playerid, COLOR_ORANGE, "-> You have recieved random amount of ammo for each of your weapons.");
  139. }
  140. else SkinSelectionPerTeam(playerid);
  141. }
  142. return 1;
  143. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement