Advertisement
Guest User

Untitled

a guest
Sep 18th, 2015
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.21 KB | None | 0 0
  1. public OnPlayerLogin(playerid,password[])
  2. {
  3. new playername2[MAX_PLAYER_NAME];
  4. GetPlayerName(playerid, playername2, sizeof(playername2));
  5. GameTextForPlayer(playerid, "~w~LOADING...~n~~y~CHECKING THE PASSWORD", 700, 3);
  6. new qstr[256];
  7. format(qstr,100,"SELECT * FROM users WHERE `name`='%s' AND `password`='%s'",playername2,password);
  8. new Cache: pass = mysql_query(SQL,qstr);
  9. if(cache_get_row_count() > 0)
  10. {
  11. cache_get_field_content(0, "password", PlayerInfo[playerid][pKey], SQL, 130);
  12. cache_get_field_content(0, "name", PlayerInfo[playerid][pNormalName], SQL, 130);
  13. PlayerInfo[playerid][pLevel] = cache_get_field_content_int(0, "Level");
  14. PlayerInfo[playerid][pAdmin] = cache_get_field_content_int(0, "Admin");
  15. PlayerInfo[playerid][pHelper] = cache_get_field_content_int(0, "Helper");
  16. PlayerInfo[playerid][pPremiumAccount] = cache_get_field_content_int(0, "Premium");
  17. PlayerInfo[playerid][pPremiumPoints] = cache_get_field_content_int(0, "PremiumPoints");
  18. PlayerInfo[playerid][pConnectTime] = cache_get_field_content_int(0, "ConnectedTime");
  19. PlayerInfo[playerid][pReg] = cache_get_field_content_int(0, "Registered");
  20. PlayerInfo[playerid][pSex] = cache_get_field_content_int(0, "Sex");
  21. PlayerInfo[playerid][pAge] = cache_get_field_content_int(0, "Age");
  22. PlayerInfo[playerid][pOrigin] = cache_get_field_content_int(0, "Origin");
  23. PlayerInfo[playerid][pMuted] = cache_get_field_content_int(0, "Muted");
  24. PlayerInfo[playerid][pMuteTime] = cache_get_field_content_int(0, "MuteTime");
  25. PlayerInfo[playerid][pExp] = cache_get_field_content_int(0, "Respect");
  26. PlayerInfo[playerid][pCash] = cache_get_field_content_int(0, "Money");
  27. PlayerInfo[playerid][pAccount] = cache_get_field_content_int(0, "Bank");
  28. PlayerInfo[playerid][pCrimes] = cache_get_field_content_int(0, "Crimes");
  29. PlayerInfo[playerid][pKills] = cache_get_field_content_int(0, "Kills");
  30. PlayerInfo[playerid][pDeaths] = cache_get_field_content_int(0, "Deaths");
  31. PlayerInfo[playerid][pArrested] = cache_get_field_content_int(0, "Arrested");
  32. PlayerInfo[playerid][pWantedDeaths] = cache_get_field_content_int(0, "WantedDeaths");
  33. PlayerInfo[playerid][pPhoneBook] = cache_get_field_content_int(0, "Phonebook");
  34. PlayerInfo[playerid][pLottoNr] = cache_get_field_content_int(0, "LottoNr");
  35. PlayerInfo[playerid][pWantedLevel] = cache_get_field_content_int(0, "WantedLevel");
  36. PlayerInfo[playerid][pFishes] = cache_get_field_content_int(0, "Fishes");
  37. PlayerInfo[playerid][pJob] = cache_get_field_content_int(0, "Job");
  38. PlayerInfo[playerid][pPayCheck] = cache_get_field_content_int(0, "Paycheck");
  39. PlayerInfo[playerid][pHeadValue] = cache_get_field_content_int(0, "HeadValue");
  40. PlayerInfo[playerid][pJailed] = cache_get_field_content_int(0, "Jailed");
  41. PlayerInfo[playerid][pJailTime] = cache_get_field_content_int(0, "JailTime");
  42. PlayerInfo[playerid][pMats] = cache_get_field_content_int(0, "Materials");
  43. PlayerInfo[playerid][pDrugs] = cache_get_field_content_int(0, "Drugs");
  44. PlayerInfo[playerid][pLeader] = cache_get_field_content_int(0, "Leader");
  45. PlayerInfo[playerid][pMember] = cache_get_field_content_int(0, "Member");
  46. PlayerInfo[playerid][pRank] = cache_get_field_content_int(0, "Rank");
  47. PlayerInfo[playerid][pFACWarns] = cache_get_field_content_int(0, "FWarn");
  48. PlayerInfo[playerid][pFpunish] = cache_get_field_content_int(0, "FPunish");
  49. PlayerInfo[playerid][pLawyer] = cache_get_field_content_int(0, "Acceptpoints");
  50. PlayerInfo[playerid][pFishSkill] = cache_get_field_content_int(0, "FishSkill");
  51. PlayerInfo[playerid][pSpawnChange] = cache_get_field_content_int(0, "SpawnChange");
  52. PlayerInfo[playerid][pRobSkill] = cache_get_field_content_int(0, "RobSkill");
  53. PlayerInfo[playerid][pTruckSkill] = cache_get_field_content_int(0, "TruckSkill");
  54. PlayerInfo[playerid][pTruckTimes] = cache_get_field_content_int(0, "TruckTimes");
  55. PlayerInfo[playerid][pTruckRem] = cache_get_field_content_int(0, "TruckRem");
  56. PlayerInfo[playerid][pFarmSkill] = cache_get_field_content_int(0, "FarmSkill");
  57. PlayerInfo[playerid][pFarmTimes] = cache_get_field_content_int(0, "FarmTimes");
  58. PlayerInfo[playerid][pFarmRem] = cache_get_field_content_int(0, "FarmRem");
  59. PlayerInfo[playerid][pFishTimes] = cache_get_field_content_int(0, "FishTimes");
  60. PlayerInfo[playerid][pFishRem] = cache_get_field_content_int(0, "FishRem");
  61. PlayerInfo[playerid][pRobRem] = cache_get_field_content_int(0, "RobRem");
  62. PlayerInfo[playerid][pRobTimes] = cache_get_field_content_int(0, "RobTimes");
  63. PlayerInfo[playerid][pHealth] = cache_get_field_content_float(0, "pHealth");
  64. PlayerInfo[playerid][pInt] = cache_get_field_content_int(0, "Inter");
  65. PlayerInfo[playerid][pLocal] = cache_get_field_content_int(0, "Local");
  66. PlayerInfo[playerid][pTeam] = cache_get_field_content_int(0, "Team");
  67. PlayerInfo[playerid][pModel] = cache_get_field_content_int(0, "Model");
  68. PlayerInfo[playerid][pPnumber] = cache_get_field_content_int(0, "PhoneNr");
  69. PlayerInfo[playerid][pPhousekey] = cache_get_field_content_int(0, "House");
  70. PlayerInfo[playerid][pPbiskey] = cache_get_field_content_int(0, "Bizz");
  71. PlayerInfo[playerid][pPos_x] = cache_get_field_content_float(0, "Pos_x");
  72. PlayerInfo[playerid][pPos_y] = cache_get_field_content_float(0, "Pos_y");
  73. PlayerInfo[playerid][pPos_z] = cache_get_field_content_float(0, "Pos_z");
  74. PlayerInfo[playerid][pRob] = cache_get_field_content_int(0, "Rob");
  75. PlayerInfo[playerid][pCarLicT] = cache_get_field_content_int(0, "CarLicT");
  76. PlayerInfo[playerid][pCarLic] = cache_get_field_content_int(0, "CarLic");
  77. PlayerInfo[playerid][pFlyLicT] = cache_get_field_content_int(0, "FlyLicT");
  78. PlayerInfo[playerid][pFlyLic] = cache_get_field_content_int(0, "FlyLic");
  79. PlayerInfo[playerid][pBoatLicT] = cache_get_field_content_int(0, "BoatLicT");
  80. PlayerInfo[playerid][pBoatLic] = cache_get_field_content_int(0, "BoatLic");
  81. PlayerInfo[playerid][pGunLicT] = cache_get_field_content_int(0, "GunLicT");
  82. PlayerInfo[playerid][pGunLic] = cache_get_field_content_int(0, "GunLic");
  83. PlayerInfo[playerid][pPayDay] = cache_get_field_content_int(0, "PayDay");
  84. PlayerInfo[playerid][pPayDayHad] = cache_get_field_content_int(0, "PayDayHad");
  85. PlayerInfo[playerid][pTut] = cache_get_field_content_int(0, "Tutorial");
  86. PlayerInfo[playerid][pWarns] = cache_get_field_content_int(0, "Warnings");
  87. PlayerInfo[playerid][pRented] = cache_get_field_content_int(0, "Rented");
  88. PlayerInfo[playerid][pFuel] = cache_get_field_content_int(0, "Fuel");
  89. PlayerInfo[playerid][pMarried] = cache_get_field_content_int(0, "Married");
  90. cache_get_field_content(0, "MarriedTo", PlayerInfo[playerid][pMarriedTo], SQL, 130);
  91. PlayerInfo[playerid][pWTalkie] = cache_get_field_content_int(0, "WTalkie");
  92. PlayerInfo[playerid][pLighter] = cache_get_field_content_int(0, "Lighter");
  93. PlayerInfo[playerid][pCigarettes] = cache_get_field_content_int(0, "Cigarettes");
  94. cache_get_field_content(0, "Email", PlayerInfo[playerid][pEmail], SQL, 255);
  95. cache_get_field_content(0, "RegisterDate", PlayerInfo[playerid][pRegistredDate], SQL, 255);
  96. PlayerInfo[playerid][pBanned] = cache_get_field_content_int(0, "Banned");
  97. PlayerInfo[playerid][pClan] = cache_get_field_content_int(0, "Clan");
  98. PlayerInfo[playerid][pRadio] = cache_get_field_content_int(0, "Radio2");
  99. PlayerInfo[playerid][pHitT] = cache_get_field_content_int(0, "HitT");
  100. PlayerInfo[playerid][pCRank] = cache_get_field_content_int(0, "CRank");
  101. PlayerInfo[playerid][pPhone] = cache_get_field_content_int(0, "Phone");
  102. PlayerInfo[playerid][pSQLID] = cache_get_field_content_int(0, "id");
  103. PlayerInfo[playerid][pPcarkey] = cache_get_field_content_int(0, "Carkey");
  104. PlayerInfo[playerid][pmotokey] = cache_get_field_content_int(0, "motokey");
  105. PlayerInfo[playerid][pprcarkey2] = cache_get_field_content_int(0, "prcarkey2");
  106. PlayerInfo[playerid][pPPluscarkey] = cache_get_field_content_int(0, "pluscarkey");
  107. PlayerInfo[playerid][pPPluscarkey2] = cache_get_field_content_int(0, "pluscarkey2");
  108. PlayerInfo[playerid][pPlusSlot1] = cache_get_field_content_int(0, "PlusSlot1");
  109. PlayerInfo[playerid][pPlusSlot2] = cache_get_field_content_int(0, "PlusSlot2");
  110. PlayerInfo[playerid][phelikey] = cache_get_field_content_int(0, "helikey");
  111. PlayerInfo[playerid][pprcarkey] = cache_get_field_content_int(0, "prcarkey");
  112. cache_get_field_content(0, "Victim", PlayerInfo[playerid][pVictim], SQL, 255);
  113. cache_get_field_content(0, "Accused", PlayerInfo[playerid][pAccused], SQL, 255);
  114. cache_get_field_content(0, "Crime1", PlayerInfo[playerid][pCrime1], SQL, 255);
  115. cache_get_field_content(0, "Crime2", PlayerInfo[playerid][pCrime2], SQL, 255);
  116. cache_get_field_content(0, "Crime3", PlayerInfo[playerid][pCrime3], SQL, 255);
  117. PlayerInfo[playerid][pBTemp] = cache_get_field_content_int(0, "BTemp");
  118. PlayerInfo[playerid][pBYear] = cache_get_field_content_int(0, "BYear");
  119. PlayerInfo[playerid][pBMonth] = cache_get_field_content_int(0, "BMonth");
  120. PlayerInfo[playerid][pBDay] = cache_get_field_content_int(0, "BDay");
  121. cache_get_field_content(0, "BBy", PlayerInfo[playerid][pBBy], SQL, 255);
  122. cache_get_field_content(0, "BReason", PlayerInfo[playerid][pBReason], SQL, 255);
  123. PlayerInfo[playerid][pStatus] = cache_get_field_content_int(0, "Status");
  124. PlayerInfo[playerid][pALeader] = cache_get_field_content_int(0, "ALeader");
  125. PlayerInfo[playerid][pLanguage] = cache_get_field_content_int(0, "Language");
  126. PlayerInfo[playerid][pClanTag] = cache_get_field_content_int(0, "ClanTag");
  127. PlayerInfo[playerid][pFWorks] = cache_get_field_content_int(0, "FWorks");
  128. PlayerInfo[playerid][pVirtualPD] = cache_get_field_content_int(0, "VirtualPD");
  129. PlayerInfo[playerid][pGlasses] = cache_get_field_content_int(0, "Glasses");
  130. PlayerInfo[playerid][pFactionTime] = cache_get_field_content_int(0, "FactionTime");
  131. PlayerInfo[playerid][pCredits] = cache_get_field_content_int(0, "CreditsF");
  132. PlayerInfo[playerid][pNMuted] = cache_get_field_content_int(0, "NMuted");
  133. PlayerInfo[playerid][pHelpedPlayers] = cache_get_field_content_int(0, "HelpedPlayers");
  134. }
  135. else
  136. {
  137. new loginstring[128],
  138. loginname[64],
  139. stringyy[128];
  140. GetPlayerName(playerid,loginname,sizeof(loginname));
  141. if(gPlayerLogTries[playerid] == 2 || gPlayerLogTries[playerid] == 1)
  142. {
  143. format(stringyy,sizeof(stringyy),"{FF0000}Incorrect password. You have %d remaining login attempts left.", gPlayerLogTries[playerid]);
  144. }
  145. SendClientMessage(playerid, COLOR_RED, stringyy);
  146. format(loginstring,sizeof(loginstring),"Welcome to the RULEPLAY RPG Server.\nPlease enter your password below!",loginname);
  147. ShowPlayerDialog(playerid,DIALOG_LOGIN3,DIALOG_STYLE_PASSWORD,"SERVER: Login",loginstring,"Login","Cancel");
  148. gPlayerLogTries[playerid] -= 1;
  149. if(gPlayerLogTries[playerid] == 0)
  150. {
  151. new stringkick[256],playip[180];
  152. GetPlayerIp(playerid, playip, sizeof(playip));
  153. format(stringkick,sizeof(stringkick),"AdmWarn:{FFFFFF} %s has been kicked for entering the wrong password 2 times. IP:%s",loginname,playip);
  154. ABroadCast(COLOR_RED,stringkick,1);
  155. KickEx(playerid);
  156. }
  157. return 1;
  158. }
  159. cache_delete(pass);
  160. ResetPlayerCash(playerid);
  161. GivePlayerCash(playerid,PlayerInfo[playerid][pCash]);
  162. CurrentMoney[playerid] = PlayerInfo[playerid][pCash];
  163. KillTimer(login[playerid]);
  164. TempBanCheck(playerid);
  165. if(PlayerInfo[playerid][pReg] == 0)
  166. {
  167. PlayerInfo[playerid][pLevel] = 1;
  168. PlayerInfo[playerid][pHealth] = 100.0;
  169. PlayerInfo[playerid][pPos_x] = 2246.6;
  170. PlayerInfo[playerid][pPos_y] = -1161.9;
  171. PlayerInfo[playerid][pPos_z] = 1029.7;
  172. PlayerInfo[playerid][pInt] = 0;
  173. PlayerInfo[playerid][pLocal] = 255;
  174. PlayerInfo[playerid][pTeam] = 3;
  175. PlayerInfo[playerid][pModel] = 250;
  176. PlayerInfo[playerid][pPnumber] = 0;
  177. PlayerInfo[playerid][pPhousekey] = 999;
  178. PlayerInfo[playerid][pPbiskey] = 255;
  179. PlayerInfo[playerid][pAccount] = 1000;
  180. PlayerInfo[playerid][pPcarkey] = 0;
  181. PlayerInfo[playerid][pmotokey] = 0;
  182. PlayerInfo[playerid][pprcarkey2] = 0;
  183. PlayerInfo[playerid][pPPluscarkey] = 0;
  184. PlayerInfo[playerid][pPPluscarkey2] = 0;
  185. PlayerInfo[playerid][phelikey] = 0;
  186. PlayerInfo[playerid][pprcarkey] = 0;
  187. PlayerInfo[playerid][pReg] = 1;
  188. SetPlayerInterior(playerid,0);
  189. new string[300],
  190. str[256],
  191. d,
  192. m,
  193. y,
  194. h,
  195. mine,
  196. s;
  197. getdate(y,m,d);
  198. gettime(h,mine,s);
  199. format(string,sizeof(string), "%d/%d/%d %d:%d:%d",d,m,y,h,mine,s);
  200. strmid(PlayerInfo[playerid][pRegistredDate], string, 0, strlen(string), 255);
  201. mysql_format(SQL,str,sizeof(str),"UPDATE users SET `pHealth`='100.0',`Team`='3',`Model`='250' WHERE `name`='%s'",PlayerInfo[playerid][pNormalName]);
  202. mysql_tquery(SQL,str,"","");
  203. Update(playerid,pCashx);
  204. Update(playerid,pLevelx);
  205. Update(playerid,pPhousekeyx);
  206. Update(playerid,pPbiskeyx);
  207. Update(playerid,pPnumberx);
  208. Update(playerid,pRegx);
  209. Update(playerid,pRegistredDatex);
  210. Update(playerid,pPcarkeyx);
  211. Update(playerid,pmotokeyx);
  212. Update(playerid,pprcarkey2x);
  213. Update(playerid,pPPluscarkeyx);
  214. Update(playerid,pPPluscarkey2x);
  215. Update(playerid,phelikeyx);
  216. Update(playerid,pprcarkeyx);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement