Guest User

Untitled

a guest
Jun 5th, 2013
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 64.07 KB | None | 0 0
  1. /*
  2. __________________________________________________________________________
  3.  
  4. _____ _____ ______ _____ _____ _______ _____
  5. / ____| __ \| ____| __ \_ _|__ __/ ____|
  6. | | | |__) | |__ | | | || | | | | (___
  7. | | | _ /| __| | | | || | | | \___ \
  8. | |____| | \ \| |____| |__| || |_ | | ____) |
  9. \_____|_| \_\______|_____/_____| |_| |_____/
  10.  
  11. CREDITS to.....
  12. -Y_Less for YINI include, sscanf include too.
  13. -Dracoblue for hashing the passwords.
  14. -Kush for making a tutorial on a login and register system.
  15. -Zeex for the ZCMD command processor.
  16. -D0erfler for his selection include
  17.  
  18. |_____You may delete all this credits, this script is all yours!____|
  19.  
  20. NOTE: If I forgot any credits, I apologize.
  21.  
  22. _____________________________________________________________________________
  23.  
  24. */
  25.  
  26. #include <a_samp>
  27. #include <easydialog>
  28. #include <mSelection>
  29. #include <sscanf2>
  30. #include <YSI\y_ini>
  31. #include <zcmd>
  32. #include <foreach>
  33.  
  34.  
  35. #define PATH "/Users/%s.ini"
  36. #define NOTADMIN "You are not authorized to use this command !"
  37. #define GetPlayerCash(%0) PlayerInfo[%0][pCash]
  38.  
  39. #define COL_WHITE "{FFFFFF}"
  40. #define COL_YELLOW "{F3FF02}"
  41. #define COL_RED "{F81414}"
  42.  
  43. #define COLOR_BITEM 0xE1B0B0FF
  44. #define COLOR_GRAD1 0xB4B5B7FF
  45. #define COLOR_GRAD2 0xBFC0C2FF
  46. #define COLOR_GRAD3 0xCBCCCEFF
  47. #define COLOR_GRAD4 0xD8D8D8FF
  48. #define COLOR_GRAD5 0xE3E3E3FF
  49. #define COLOR_GRAD6 0xF0F0F0FF
  50. #define COLOR_GREY 0xAFAFAFAA
  51. #define COLOR_GREEN 0x33AA33AA
  52. #define COLOR_RED 0xAA3333AA
  53. #define COLOR_BLACK 0x000001FF
  54. #define COLOR_BLUE 0x007BD0FF
  55. #define COLOR_LIGHTORANGE 0xFFA100FF
  56. #define COLOR_FLASH 0xFF000080
  57. #define COLOR_LIGHTRED 0xFF6347AA
  58. #define COLOR_LIGHTBLUE 0x33CCFFAA
  59. #define COLOR_LIGHTGREEN 0x9ACD32AA
  60. #define COLOR_YELLOW 0xFFFF00AA
  61. #define COLOR_LIGHTYELLOW 0xFFFF91FF
  62. #define COLOR_YELLOW2 0xF5DEB3AA
  63. #define COLOR_WHITE 0xFFFFFFAA
  64. #define COLOR_FADE1 0xE6E6E6E6
  65. #define COLOR_FADE2 0xC8C8C8C8
  66. #define COLOR_FADE3 0xAAAAAAAA
  67. #define COLOR_FADE4 0x8C8C8C8C
  68. #define COLOR_FADE5 0x6E6E6E6E
  69. #define COLOR_PURPLE 0xC2A2DAAA
  70. #define COLOR_DBLUE 0x2641FEAA
  71. #define COLOR_DOC 0xFF8282AA
  72. #define COLOR_DCHAT 0xF0CC00FF
  73. #define COLOR_NEWS 0xFFA500AA
  74. #define COLOR_OOC 0xE0FFFFAA
  75. #define TEAM_BLUE_COLOR 0x8D8DFF00
  76. #define TEAM_GROVE_COLOR 0x00AA00FF
  77. #define TEAM_AZTECAS_COLOR 0x01FCFFC8
  78. #define NEWBIE_COLOR 0x7DAEFFFF
  79. #define SAMP_COLOR 0xAAC4E5FF
  80.  
  81. //Fowards
  82. forward split(const strsrc[], strdest[][], delimiter);
  83. forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
  84. forward ProxDetectorS(Float:radi, playerid, targetid);
  85. forward LoadUser_data(playerid,name[],value[]);
  86. forward SaveAccountInfo(playerid);
  87. forward OOCOff(color,const string[]);
  88. forward FixHour(hour);
  89. forward IsValidName(playerid);
  90.  
  91. //Forwarded Logs
  92. forward PayLog(string[]);
  93. forward BanLog(string[]);
  94. forward KickLog(string[]);
  95. forward AdminLog(string[]);
  96. //-------------------------------------
  97. //Variables
  98. new gPlayerLogged[MAX_PLAYERS char];
  99. new gAdminAuthorized[MAX_PLAYERS];
  100. new gOOC[MAX_PLAYERS];
  101. new HidePM[MAX_PLAYERS];
  102. new PayWarn[MAX_PLAYERS][MAX_PLAYERS];
  103.  
  104. new noooc = 0;
  105. new realchat = 1;
  106. new timeshift = -1;
  107. new shifthour;
  108. new Connected[MAX_PLAYERS] = 0;
  109. new spec[MAX_PLAYERS] = -1;
  110. //new masked = 0
  111. /*textdraw selection*/
  112. new skinlist = mS_INVALID_LISTID;
  113. new vehlist = mS_INVALID_LISTID;
  114. /*admin duty*/
  115. new AdminDuty[MAX_PLAYERS] = 0;
  116. new aCash[MAX_PLAYERS];
  117. //-----------------------------
  118.  
  119. enum pInfo
  120. {
  121. pName[70],
  122. pPass,
  123. pAdmin,
  124. pAName[24],
  125. Float:pAx,
  126. Float:pAy,
  127. Float:pAz,
  128. pSecKey,
  129. pCash,
  130. pSkin,
  131. pLevel,
  132. pInt,
  133. pVW,
  134. pKills,
  135. pDeaths,
  136. Float:pFacingAngle,
  137. Float:pHealth,
  138. Float:pArmour,
  139. Float:pLastX,
  140. Float:pLastY,
  141. Float:pLastZ
  142. }
  143. new PlayerInfo[MAX_PLAYERS][pInfo];
  144.  
  145. //Fowarded Public Functions
  146. public AdminLog(string[])
  147. {
  148. new entry[256];
  149. format(entry, sizeof(entry), "%s\n",string);
  150. new File:hFile;
  151. hFile = fopen("admin.log", io_append);
  152. fwrite(hFile, entry);
  153. fclose(hFile);
  154. }
  155. public PayLog(string[])
  156. {
  157. new entry[256];
  158. format(entry, sizeof(entry), "%s\n",string);
  159. new File:hFile;
  160. hFile = fopen("pay.log", io_append);
  161. fwrite(hFile, entry);
  162. fclose(hFile);
  163. }
  164.  
  165. public KickLog(string[])
  166. {
  167. new entry[256];
  168. format(entry, sizeof(entry), "%s\n",string);
  169. new File:hFile;
  170. hFile = fopen("kick.log", io_append);
  171. fwrite(hFile, entry);
  172. fclose(hFile);
  173. }
  174.  
  175. public BanLog(string[])
  176. {
  177. new entry[256];
  178. format(entry, sizeof(entry), "%s\n",string);
  179. new File:hFile;
  180. hFile = fopen("ban.log", io_append);
  181. fwrite(hFile, entry);
  182. fclose(hFile);
  183. }
  184.  
  185. public IsValidName(playerid)
  186. {
  187. new pname[MAX_PLAYER_NAME],underline=0;
  188. GetPlayerName(playerid, pname, sizeof(pname));
  189. if(strfind(pname,"[",true) != (-1)) return 0;
  190. else if(strfind(pname,".",true) != (-1)) return 0;
  191. else if(strfind(pname,"]",true) != (-1)) return 0;
  192. else if(strfind(pname,"$",true) != (-1)) return 0;
  193. else if(strfind(pname,"(",true) != (-1)) return 0;
  194. else if(strfind(pname,")",true) != (-1)) return 0;
  195. else if(strfind(pname,"=",true) != (-1)) return 0;
  196. else if(strfind(pname,"@",true) != (-1)) return 0;
  197. else if(strfind(pname,"1",true) != (-1)) return 0;
  198. else if(strfind(pname,"2",true) != (-1)) return 0;
  199. else if(strfind(pname,"3",true) != (-1)) return 0;
  200. else if(strfind(pname,"4",true) != (-1)) return 0;
  201. else if(strfind(pname,"5",true) != (-1)) return 0;
  202. else if(strfind(pname,"6",true) != (-1)) return 0;
  203. else if(strfind(pname,"7",true) != (-1)) return 0;
  204. else if(strfind(pname,"8",true) != (-1)) return 0;
  205. else if(strfind(pname,"9",true) != (-1)) return 0;
  206. new maxname = strlen(pname);
  207. for(new i=0; i<maxname; i++) { if(pname[i] == '_') underline ++; }
  208. if(underline != 1) return 0;
  209. pname[0] = toupper(pname[0]);
  210. for(new x=1; x<maxname; x++)
  211. {
  212. if(pname[x] == '_') pname[x+1] = toupper(pname[x+1]);
  213. else if(pname[x] != '_' && pname[x-1] != '_') pname[x] = tolower(pname[x]);
  214. }
  215. return 1;
  216. }
  217.  
  218. public ProxDetectorS(Float:radi, playerid, targetid)
  219. {
  220. if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
  221. {
  222. new Float:posx, Float:posy, Float:posz;
  223. new Float:oldposx, Float:oldposy, Float:oldposz;
  224. new Float:tempposx, Float:tempposy, Float:tempposz;
  225. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  226. GetPlayerPos(targetid, posx, posy, posz);
  227. tempposx = (oldposx -posx);
  228. tempposy = (oldposy -posy);
  229. tempposz = (oldposz -posz);
  230. if(((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  231. {
  232. return 1;
  233. }
  234. }
  235. return 0;
  236. }
  237.  
  238. public FixHour(hour)
  239. {
  240. hour = timeshift+hour;
  241. if(hour < 0) { hour = hour+24; }
  242. else if(hour > 23) { hour = hour-24; }
  243. shifthour = hour;
  244. return 1;
  245. }
  246.  
  247.  
  248. public OOCOff(color,const string[])
  249. {
  250. for(new i = 0; i < MAX_PLAYERS; i++)
  251. {
  252. if(IsPlayerConnected(i))
  253. {
  254. if(!gOOC[i])
  255. {
  256. SendClientMessage(i, color, string);
  257. }
  258. }
  259. }
  260. }
  261.  
  262. public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
  263. {
  264. if(IsPlayerConnected(playerid))
  265. {
  266. new Float:posx, Float:posy, Float:posz;
  267. new Float:oldposx, Float:oldposy, Float:oldposz;
  268. new Float:tempposx, Float:tempposy, Float:tempposz;
  269. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  270. for(new i = 0; i < MAX_PLAYERS; i++)
  271. {
  272. if(IsPlayerConnected(i))
  273. {
  274. GetPlayerPos(i, posx, posy, posz);
  275. tempposx = (oldposx -posx);
  276. tempposy = (oldposy -posy);
  277. tempposz = (oldposz -posz);
  278. new playerworld, player2world;
  279. playerworld = GetPlayerVirtualWorld(playerid);
  280. player2world = GetPlayerVirtualWorld(i);
  281. if(playerworld == player2world)
  282. {
  283. if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
  284. {
  285. SendClientMessage(i, col1, string);
  286. }
  287. else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
  288. {
  289. SendClientMessage(i, col2, string);
  290. }
  291. else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
  292. {
  293. SendClientMessage(i, col3, string);
  294. }
  295. else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
  296. {
  297. SendClientMessage(i, col4, string);
  298. }
  299. else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  300. {
  301. SendClientMessage(i, col5, string);
  302. }
  303. }
  304. else
  305. {
  306. SendClientMessage(i, col1, string);
  307. }
  308. }
  309. }
  310. }
  311. return 1;
  312. }
  313.  
  314. public SaveAccountInfo(playerid)
  315. {
  316. if(!IsPlayerConnected(playerid)) return 1;
  317. if(AdminDuty[playerid] == 1) return print("Did not save, admin duty.");
  318. new cash = GetPlayerMoney(playerid);
  319. new skin = GetPlayerSkin(playerid);
  320. new level = GetPlayerScore(playerid);
  321. new int = GetPlayerInterior(playerid);
  322. new vw = GetPlayerVirtualWorld(playerid);
  323. new Float:X, Float:Y, Float:Z;
  324. new Float:facingangle;
  325. new Float:health, Float:armour;
  326. GetPlayerHealth(playerid, health);
  327. GetPlayerArmour(playerid, armour);
  328. GetPlayerName(playerid, PlayerInfo[playerid][pName], 70);
  329. GetPlayerFacingAngle(playerid, facingangle);
  330. GetPlayerPos(playerid, X, Y, Z);
  331. new INI:File = INI_Open(UserPath(playerid));
  332. INI_SetTag(File,"data");
  333. INI_WriteString(File,"Name",PlayerInfo[playerid][pName]);
  334. INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
  335. INI_WriteString(File,"AdminName",PlayerInfo[playerid][pAName]);
  336. INI_WriteInt(File,"SecKey",PlayerInfo[playerid][pSecKey]);
  337. INI_WriteInt(File,"Cash",cash);
  338. INI_WriteInt(File,"Skin",skin);
  339. INI_WriteInt(File,"Level",level);
  340. INI_WriteInt(File,"Int",int);
  341. INI_WriteInt(File,"VW",vw);
  342. INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
  343. INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
  344. INI_WriteFloat(File, "FacingAngle", facingangle);
  345. INI_WriteFloat(File, "Health", health);
  346. INI_WriteFloat(File, "Armour", armour);
  347. INI_WriteFloat(File, "LastX", X);
  348. INI_WriteFloat(File, "LastY", Y);
  349. INI_WriteFloat(File, "LastZ", Z);
  350. INI_Close(File);
  351. return 1;
  352. }
  353.  
  354. public LoadUser_data(playerid,name[],value[])
  355. {
  356. INI_String("Name",PlayerInfo[playerid][pName], 70);
  357. INI_Int("Password",PlayerInfo[playerid][pPass]);
  358. INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
  359. INI_String("AdminName",PlayerInfo[playerid][pAName], 24);
  360. INI_Int("SecKey",PlayerInfo[playerid][pSecKey]);
  361. INI_Int("Cash",PlayerInfo[playerid][pCash]);
  362. INI_Int("Skin",PlayerInfo[playerid][pSkin]);
  363. INI_Int("Level",PlayerInfo[playerid][pLevel]);
  364. INI_Int("Kills",PlayerInfo[playerid][pKills]);
  365. INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
  366. INI_Float("FacingAngle",PlayerInfo[playerid][pFacingAngle]);
  367. INI_Float("Health",PlayerInfo[playerid][pHealth]);
  368. INI_Float("Armour",PlayerInfo[playerid][pArmour]);
  369. INI_Float("LastX", PlayerInfo[playerid][pLastX]);
  370. INI_Float("LastY", PlayerInfo[playerid][pLastY]);
  371. INI_Float("LastZ", PlayerInfo[playerid][pLastZ]);
  372. return 1;
  373. }
  374.  
  375. public split(const strsrc[], strdest[][], delimiter)
  376. {
  377. new i, li;
  378. new aNum;
  379. new len;
  380. while(i <= strlen(strsrc)){
  381. if(strsrc[i]==delimiter || i==strlen(strsrc)){
  382. len = strmid(strdest[aNum], strsrc, li, i, 128);
  383. strdest[aNum][len] = 0;
  384. li = i+1;
  385. aNum++;
  386. }
  387. i++;
  388. }
  389. return 1;
  390. }
  391. //DIALOGS
  392. Dialog:login(playerid, response, listitem, inputtext[])
  393. {
  394. new tmp2[256];
  395. if ( !response ) return Kick ( playerid );
  396. if( response )
  397. {
  398. if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
  399. {
  400. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  401. SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pLastX], PlayerInfo[playerid][pLastY], PlayerInfo[playerid][pLastZ], PlayerInfo[playerid][pFacingAngle], 0, 0, 0, 0, 0, 0);
  402. SpawnPlayer(playerid);
  403. GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
  404. SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
  405. SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
  406. SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
  407. SetPlayerArmour(playerid, PlayerInfo[playerid][pArmour]);
  408. SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
  409. SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVW]);
  410. format(tmp2, sizeof(tmp2), "~w~Welcome ~n~~y~ %s", GetName(playerid));
  411. GameTextForPlayer(playerid, tmp2, 5000, 1);
  412. TogglePlayerSpectating(playerid, 0);
  413. if(PlayerInfo[playerid][pAdmin] >= 1)
  414. {
  415. format(tmp2, sizeof(tmp2), "SERVER: You are logged in as a Level %d Admin.",PlayerInfo[playerid][pAdmin]);
  416. SendClientMessage(playerid, COLOR_WHITE,tmp2);
  417. ShowDialog(playerid,Show:asec,DIALOG_STYLE_INPUT,"Admin Login","Please provide your security code for your admin account to be authorized.\n\nPlease enter your security code below.","Ok","Cancel"); //admin authorization
  418. }
  419. }
  420. else
  421. {
  422. ShowDialog(playerid,Show:login,DIALOG_STYLE_PASSWORD,"Invalid password",""COL_RED"Please try again.\n\nType your password below.","Ok","Cancel");
  423. }
  424. return 1;
  425. }
  426. return 1;
  427. }
  428. Dialog:register(playerid, response, listitem, inputtext[])
  429. {
  430. new tmp2[256];
  431. if (!response) return Kick(playerid);
  432. if(response)
  433. {
  434. if(strlen(inputtext) < 4) return ShowDialog(playerid,Show:register,DIALOG_STYLE_PASSWORD,"Short password",""COL_RED"Please try again.\n\nType your password below.","Ok","Cancel");
  435. new INI:File = INI_Open(UserPath(playerid));
  436. INI_SetTag(File,"data");
  437. INI_WriteInt(File,"Password",udb_hash(inputtext));
  438. INI_WriteInt(File,"Cash",0);
  439. INI_WriteInt(File,"Skin",0);
  440. INI_WriteInt(File,"Level",0);
  441. INI_WriteInt(File,"Int",0);
  442. INI_WriteInt(File,"VW",0);
  443. INI_WriteInt(File,"Admin",0);
  444. INI_WriteInt(File,"SecKey",0);
  445. INI_WriteInt(File,"Kills",0);
  446. INI_WriteInt(File,"Deaths",0);
  447. INI_WriteFloat(File,"FacingAngle",0);
  448. INI_WriteFloat(File,"Health",0);
  449. INI_WriteFloat(File,"Armour",0);
  450. INI_WriteFloat(File,"LastX",0);
  451. INI_WriteFloat(File,"LastY",0);
  452. INI_WriteFloat(File,"LastZ",0);
  453. INI_Close(File);
  454. SetSpawnInfo(playerid, 0, 299, 982.1890, -1624.2583, 14.9526, 90, 0, 0, 0, 0, 0, 0);
  455. SpawnPlayer(playerid);
  456. ResetPlayerWeapons(playerid);
  457. SetPlayerInterior(playerid,0);
  458. SetPlayerVirtualWorld(playerid, 0);
  459. SetPlayerScore(playerid, 1);
  460. GivePlayerMoney(playerid, 1000);
  461. SetCameraBehindPlayer(playerid);
  462. PlayerInfo[playerid][pSkin] = 299;
  463. PlayerInfo[playerid][pInt] = 0;
  464. PlayerInfo[playerid][pVW] = 0;
  465. PlayerInfo[playerid][pLevel] = 1;
  466. SendClientMessage(playerid, COLOR_YELLOW, "Account registered, you have been logged in automatically.");
  467. format(tmp2, sizeof(tmp2), "~w~Welcome ~n~~y~ %s", GetName(playerid));
  468. GameTextForPlayer(playerid, tmp2, 5000, 1);
  469. TogglePlayerSpectating(playerid, 0);
  470. }
  471. return 1;
  472. }
  473. Dialog:asec(playerid, response, listitem, inputtext[])
  474. {
  475. new tmp2[256];
  476. if(gAdminAuthorized[playerid] == 1) return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Your admin account has already been authorized.");
  477. {
  478. if(!response) return Kick(playerid);
  479. if(response)
  480. {
  481. if(!strlen(inputtext))
  482. {
  483. ShowDialog(playerid,Show:asec,DIALOG_STYLE_INPUT,"Admin Login","Please provide your security code for your admin account to be authorized.\n\nPlease enter your security code below.","Login","Quit"); //admin authorization
  484. SendClientMessage(playerid, COLOR_WHITE, "SERVER: You must enter your security code.");
  485. return 1;
  486. }
  487. if(strlen(inputtext) >= 50)
  488. {
  489. ShowDialog(playerid,Show:asec,DIALOG_STYLE_INPUT,"Admin Login","Please provide your security code for your admin account to be authorized.\n\nPlease enter your security code below.","Login","Quit"); //admin authorization
  490. SendClientMessage(playerid, COLOR_WHITE, "SERVER: Security code is too long.");
  491. return 0;
  492. }
  493. if(fexist(UserPath(playerid)))
  494. {
  495. new tmp;
  496. new seckey = strval(inputtext);
  497. tmp = PlayerInfo[playerid][pSecKey];
  498. if(tmp == 0)
  499. {
  500. SendClientMessage(playerid, COLOR_RED, "SERVER: You do not have a valid Security Key.");
  501. Kick(playerid);
  502. return 1;
  503. }
  504. if(seckey != tmp)
  505. {
  506. SendClientMessage(playerid, COLOR_RED, "SERVER: Security Key does not match. You have been kicked as a result.");
  507. Kick(playerid);
  508. return 1;
  509. }
  510. else
  511. {
  512. gAdminAuthorized[playerid] = 1;
  513. SendClientMessage(playerid, COLOR_WHITE, "SERVER: Your admin account has successfully been authorized.");
  514. format(tmp2, sizeof(tmp2), "~w~Welcome ~n~~y~ %s", GetName(playerid));
  515. GameTextForPlayer(playerid, tmp2, 5000, 1);
  516. TogglePlayerSpectating(playerid, 0);
  517. return 1;
  518. }
  519. }
  520. }
  521. }
  522. return 1;
  523. }
  524. //STOCKS
  525. stock SetPlayerMoney(playerid, cash)
  526. {
  527. ResetPlayerMoney(playerid);
  528. return GivePlayerMoney(playerid, cash);
  529. }
  530. stock SendClientMessageToAdmins(color,string[],level)
  531. {
  532. foreach(Player, i)
  533. {
  534. if(!IsPlayerConnected(i)) return 1;
  535. if(PlayerInfo[i][pAdmin] >= level && Connected[i] == 1)
  536. {
  537. SendClientMessage(i, color, string);
  538. //printf("%s", string);
  539. }
  540. }
  541. return 1;
  542. }
  543. stock ABroadCast(color,string[],level)
  544. {
  545. foreach(Player, i)
  546. {
  547. if (PlayerInfo[i][pAdmin] >= level)
  548. {
  549. SendClientMessage(i, color, string);
  550. printf("%s", string);
  551. }
  552. }
  553. return 1;
  554. }
  555. stock GetPlayerFirstName(playerid)
  556. {
  557. new namestring[2][MAX_PLAYER_NAME];
  558. new name[MAX_PLAYER_NAME];
  559. GetPlayerName(playerid,name,MAX_PLAYER_NAME);
  560. split(name, namestring, '_');
  561. return namestring[0];
  562. }
  563.  
  564. stock UserPath(playerid)
  565. {
  566. new string[128],playername[MAX_PLAYER_NAME];
  567. GetPlayerName(playerid,playername,sizeof(playername));
  568. format(string,sizeof(string),PATH,playername);
  569. return string;
  570. }
  571.  
  572. stock udb_hash(buf[]) {
  573. new length=strlen(buf);
  574. new s1 = 1;
  575. new s2 = 0;
  576. new n;
  577. for (n=0; n<length; n++)
  578. {
  579. s1 = (s1 + buf[n]) % 65521;
  580. s2 = (s2 + s1) % 65521;
  581. }
  582. return (s2 << 16) + s1;
  583. }
  584.  
  585. stock strreplace(string[], find, replace)
  586. {
  587. for(new i=0; string[i]; i++)
  588. {
  589. if(string[i] == find)
  590. {
  591. string[i] = replace;
  592. }
  593. }
  594. }
  595.  
  596. stock GetName(playerid)
  597. {
  598. new
  599. name[24];
  600. GetPlayerName(playerid, name, sizeof(name));
  601. strreplace(name, '_', ' ');
  602. return name;
  603. }
  604. //--------------------------------------------------
  605.  
  606. main()
  607. {
  608. print("\n----------------------------------");
  609. print("* Dgaming load sucessfully....");
  610. print("----------------------------------\n");
  611. }
  612.  
  613. public OnGameModeInit()
  614. {
  615. SetGameModeText("CHANGEME");
  616. SetNameTagDrawDistance(30.0);
  617. AllowInteriorWeapons(1);
  618. UsePlayerPedAnims();
  619. ShowPlayerMarkers(0);
  620. EnableStuntBonusForAll(0);
  621. DisableInteriorEnterExits();
  622. skinlist = LoadModelSelectionMenu("skins.txt");
  623. vehlist = LoadModelSelectionMenu("veh.txt");
  624. /*
  625. DO NOT DELETE THIS ADDPLAYERCLASS or else it will cause problems to the server.
  626. When you die, your screen will flash repeadetly and it'll say do not leave the world boundries or something..
  627. ... w/e and you'll have to relog every single time. SO DO NOT DELETE.
  628. You can also remove this warning if you want and will remember not to delete it.
  629. */
  630. AddPlayerClass(299, 0.0, 0.0, 0.0, 90.0, 0, 0, 0, 0, 0, 0);
  631.  
  632. //VEHICLES
  633. //LSPD
  634. AddStaticVehicleEx(523,1585.2291,-1676.4011,5.4624,270.0000,-1,-1,900); //police bike
  635. AddStaticVehicleEx(523,1585.2291,-1679.0729,5.4607,270.0000,-1,-1,900); //police bike
  636. AddStaticVehicleEx(596,1583.3301,-1710.1624,5.6129,0,-1,-1,900); //police lspd car
  637. AddStaticVehicleEx(598,1587.4896,-1710.1624,5.6129,0,-1,-1,900); //police lvpd car
  638. AddStaticVehicleEx(427,1558.7682,-1710.4094,6.0225,359.5701,-1,-1,900); //police enforcer
  639. AddStaticVehicleEx(596,1578.5399,-1710.1624,5.6129,0,-1,-1,900); //police lspd car
  640. AddStaticVehicleEx(596,1574.4989,-1710.1624,5.6129,0,-1,-1,900); //police lspd car
  641. AddStaticVehicleEx(596,1570.3170,-1710.1624,5.6129,0,-1,-1,900); //police lspd car
  642. AddStaticVehicleEx(596,1535.7517,-1678.2754,15.0000,0,-1,-1,900); //police lspd car
  643. AddStaticVehicleEx(497,1549.5,-1644.1257,33.0,90.0,0,1,900); // Roof Chopper
  644. AddStaticVehicleEx(497,1549.5,-1707.3848,33.0,90.0,0,1,900); // Roof Chopper
  645. AddStaticVehicleEx(601,1564.4753,-1711.6448,5.6510,5.6801,-1,-1,900); //swat tank
  646. AddStaticVehicleEx(528,1558.0299,-1694.0360,5.9432,180,-1,-1,900); //swat vehicle
  647. AddStaticVehicleEx(528,1561.2257,-1694.0164,5.9347,180,-1,-1,900); //swat vehicle 02
  648. AddStaticVehicleEx(598,1591.4315,-1710.1624,5.6255,0,-1,-1,900); //police lvpd car
  649. AddStaticVehicleEx(596,1601.8004,-1704.2368,5.6111,90,-1,-1,900); //police lspd car
  650. AddStaticVehicleEx(596,1601.8004,-1700.1127,5.6111,90,-1,-1,900); //police lspd car
  651. AddStaticVehicleEx(596,1601.8004,-1696.0378,5.6111,90,-1,-1,900); //police lspd car
  652. AddStaticVehicleEx(596,1601.8004,-1691.9602,5.6111,90,-1,-1,900); //police lspd car
  653. AddStaticVehicleEx(596, 1535.7517, -1668.5831, 13.1053, 360.0000, 0, 1, 900); // police lspd car
  654. AddStaticVehicleEx(599,1585.3041,-1671.7306,6.1209,269.1276,0,1,900); //police rancher car
  655. AddStaticVehicleEx(599,1585.5951,-1667.6407,6.0218,270.1369,0,1,900); //police rancher car
  656. AddStaticVehicleEx(598,1601.8846,-1683.9987,5.6107,89.8121,0,1,900); //police lvpd car
  657. AddStaticVehicleEx(598,1602.0452,-1687.9415,5.6112,90.9819,0,1,900); //police lvpd car
  658. AddStaticVehicleEx(523,1600.2445,-1711.6592,5.4535,44.0296,0,1,900); //police bike
  659. AddStaticVehicleEx(523,1602.6547,-1709.4182,5.4535,46.7312,0,1,900); //police bike
  660. AddStaticVehicleEx(598,1595.4485,-1710.2502,5.6096,359.5797,0,1,900); //police lvpd car
  661. //HOSPITAL
  662. AddStaticVehicleEx(563, 1162.5315, -1373.2607, 32.3312, 270.1107, 3, 1, 900); // Raindance 1
  663. AddStaticVehicleEx(563, 1163.3928, -1357.1760, 32.3656, 269.4890, 3, 1, 900); //Raindance 2
  664. //AIRPORT
  665. AddStaticVehicleEx(519,1889.6531,-2629.1267,14.4657,0,-1,-1,900); // Shamal 1
  666. AddStaticVehicleEx(519,1823.1190,-2629.1267,14.4657,0,-1,-1,900); // Shamal 2
  667. AddStaticVehicleEx(519,1754.5325,-2629.1267,14.4657,0,-1,-1,900); // Shamal 3
  668. AddStaticVehicleEx(487,1964.2646,-2629.1267,13.7619,0,-1,-1,900); // Heli 1
  669. AddStaticVehicleEx(487,1944.7985,-2629.1267,13.7354,0,-1,-1,900); // Heli 2
  670. AddStaticVehicleEx(417,1765.6274,-2285.0801,26.8743,0,-1,-1,900); // Levi 1
  671. AddStaticVehicleEx(593,1616.7531,-2627.9131,14.0094,0,-1,-1,900); // Dodo 1
  672. AddStaticVehicleEx(593,1681.9587,-2627.9131,14.0094,0,-1,-1,900); // Dodo 2
  673. //BOATS
  674. AddStaticVehicleEx(430,2473.2754,-2716.4000,0,90,-1,-1,900); // LSPD 1
  675. AddStaticVehicleEx(430,2446.4270,-2716.4000,0,90,-1,-1,900); // LSPD 2
  676. //BIKES
  677. AddStaticVehicleEx(481,1909.3695,-1416.4291,16.0000,90.0000,26,1,900); // Skatepark 1
  678. AddStaticVehicleEx(481,1927.2667,-1436.1995,16.0000,90.0000,26,1,900); // Skatepark 2
  679. //FBI
  680. AddStaticVehicleEx(490,1759.6000,-1680.1136,16.0000,270.0000,0,0,900); // Rancher 1
  681. AddStaticVehicleEx(490,1759.6000,-1675.2715,16.0000,270.0000,0,0,900); // Rancher 2
  682. AddStaticVehicleEx(482,1759.6000,-1667.3435,16.0000,270.0000,0,0,900); // Burrito 1
  683. AddStaticVehicleEx(482,1759.6000,-1661.9944,16.0000,270.0000,0,0,900); // Burrito 2
  684. AddStaticVehicleEx(415,1775.1281,-1703.4574,16.0000,358.0000,0,0,900); // Cheetah 1
  685. AddStaticVehicleEx(415,1783.0220,-1703.4574,16.0000,358.0000,0,0,900); // Cheetah 2
  686. //TAXI VEHICLES
  687. AddStaticVehicleEx(438,1732.7784,-1858.6791,16.000,270,-1,-1,900); // Oldschool Cab 1
  688. AddStaticVehicleEx(438,1755.5264,-1858.6791,16.000,270,-1,-1,900); // Oldschool Cab 2
  689. AddStaticVehicleEx(438,1802.4722,-1864.7412,13.5806,358.2501,-1,-1,900); // Oldschool Cab 3
  690. AddStaticVehicleEx(438,1798.2456,-1864.6693,13.5776,359.2436,-1,-1,900); // Oldschool Cab 4
  691. AddStaticVehicleEx(420,1749.4923,-1851.2766,16.000,90,-1,-1,900); // Taxi 1
  692. AddStaticVehicleEx(420,1730.4237,-1851.2766,16.000,90,-1,-1,900); // Taxi 2
  693. AddStaticVehicleEx(420,1791.7245,-1864.8146,13.3530,0,-1,-1,900); // Taxi 3
  694. //GROVE
  695. AddStaticVehicleEx(550,2489.4717,-1682.6398,13.1574,270.4214,86,86,900); // Sunrise 1
  696. AddStaticVehicleEx(550,2487.4917,-1655.0593,13.1558,90.0239,86,86,900); // Sunrise 2
  697. AddStaticVehicleEx(492,2506.0317,-1676.8611,13.1585,325.6313,86,36,900); // Greenwood 3
  698. AddStaticVehicleEx(492,2508.3210,-1666.6718,13.1791,13.1814,86,36,900); // Greenwood 4
  699. AddStaticVehicleEx(509,2525.9890,-1663.8104,16.0,90.0,86,36,900); // Grove Street LowRiderbike #1
  700. AddStaticVehicleEx(509,2527.8147,-1663.8104,16.0,90.0,86,36,900); // Grove Street LowRiderbike #2
  701. //BALLAS
  702. AddStaticVehicleEx(566,2015.3771,-1130.9552,24.7592,89.4981,85,85,900); // Tahoma 1
  703. AddStaticVehicleEx(566,1993.3444,-1130.9552,25.3730,89.4981,85,85,900); // Tahoma 2
  704. AddStaticVehicleEx(566,2013.4194,-1094.5210,24.4616,339.1252,85,85,900); // Tahoma 3
  705. AddStaticVehicleEx(566,2008.5813,-1092.7949,24.4593,339.3990,85,85,900); // Tahoma 4
  706. //TRAIN
  707. AddStaticVehicleEx(538,1700.7551,-1953.6531,14.8756,200.0,-1,-1,900); // Train
  708. return 1;
  709. }
  710.  
  711. public OnGameModeExit()
  712. {
  713. return 1;
  714. }
  715.  
  716. public OnPlayerRequestClass(playerid, classid)
  717. {
  718. return 1;
  719. }
  720.  
  721. public OnPlayerConnect(playerid)
  722. {
  723. new string[128];
  724. if(fexist(UserPath(playerid)))
  725. {
  726. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  727. ShowDialog(playerid,Show:login,DIALOG_STYLE_PASSWORD,"Welcome back","Welcome to Dgaming Roleplay.\n\nThat name is registered. Please enter your password below.","Ok","Cancel"); //login
  728. format(string, sizeof(string), ""COL_WHITE"Welcome back to "COL_YELLOW"CHANGEME, "COL_WHITE"%s!", GetPlayerFirstName(playerid));
  729. SendClientMessage(playerid, -1, string);
  730. }
  731. else
  732. {
  733. ShowDialog(playerid,Show:register,DIALOG_STYLE_PASSWORD,"Join us now","Please register your account by typing the password below.","Ok","Cancel");
  734. format(string, sizeof(string), ""COL_WHITE"Welcome to "COL_YELLOW"CHANGEME, "COL_WHITE"%s!", GetPlayerFirstName(playerid));
  735. SendClientMessage(playerid, -1, string);
  736. }
  737. if(!IsValidName(playerid) && !IsPlayerNPC(playerid) && PlayerInfo[playerid][pAdmin] < 2)
  738. {
  739. format(string, sizeof(string), "AdmCmd: %s has been kicked by NameChecker, reason: Invalid name format.", GetName(playerid));
  740. SendClientMessage(playerid, COLOR_LIGHTRED, "You've been kicked by NameChecker, reason: Invalid name format. (Firstname_Lastname)");
  741. Kick(playerid);
  742. }
  743. SetPlayerInterior(playerid,0);
  744. TogglePlayerSpectating(playerid, 1);
  745. gPlayerLogged[playerid] = 1;
  746. return 1;
  747. }
  748.  
  749. public OnPlayerDisconnect(playerid, reason)
  750. {
  751. new discstring[128];
  752. switch(reason)
  753. {
  754. case 0: format(discstring, sizeof(discstring), "* %s has left the server. (Timeout)", GetName(playerid));
  755. case 1: format(discstring, sizeof(discstring), "* %s has left the server. (Leaving)", GetName(playerid));
  756. case 2: format(discstring, sizeof(discstring), "* %s has left the server. (Kicked)", GetName(playerid));
  757. }
  758. ProxDetector(30.0, playerid, discstring, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW);
  759. SaveAccountInfo(playerid);
  760. return 1;
  761. }
  762.  
  763. public OnPlayerSpawn(playerid)
  764. {
  765. return 1;
  766. }
  767.  
  768. public OnPlayerDeath(playerid, killerid, reason)
  769. {
  770. PlayerInfo[killerid][pKills]++;
  771. PlayerInfo[playerid][pDeaths]++;
  772. SetPlayerPos(playerid, 982.1890, -1624.2583, 14.9526);
  773. SetPlayerFacingAngle(playerid, 90);
  774. return 1;
  775. }
  776.  
  777. public OnVehicleSpawn(vehicleid)
  778. {
  779. return 1;
  780. }
  781.  
  782. public OnVehicleDeath(vehicleid, killerid)
  783. {
  784. return 1;
  785. }
  786.  
  787. public OnPlayerText(playerid, text[])
  788. {
  789. if (realchat)
  790. {
  791. new string[128];
  792. format(string, sizeof(string), "%s says: %s", GetName(playerid), text);
  793. ProxDetector(30.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
  794. format(string, sizeof(string), "says: %s", text);
  795. SetPlayerChatBubble(playerid,string,COLOR_WHITE,5.0,5000);
  796. ApplyAnimation(playerid,"PED","IDLE_CHAT",2.0,1,0,0,1,1);
  797. return 0;
  798. }
  799. return 1;
  800. }
  801.  
  802. public OnPlayerCommandText(playerid, cmdtext[])
  803. {
  804. if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  805. {
  806. // Do something here
  807. return 1;
  808. }
  809. return 0;
  810. }
  811.  
  812. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  813. {
  814. return 1;
  815. }
  816.  
  817. public OnPlayerExitVehicle(playerid, vehicleid)
  818. {
  819. return 1;
  820. }
  821.  
  822. public OnPlayerStateChange(playerid, newstate, oldstate)
  823. {
  824. return 1;
  825. }
  826.  
  827. public OnPlayerEnterCheckpoint(playerid)
  828. {
  829. return 1;
  830. }
  831.  
  832. public OnPlayerLeaveCheckpoint(playerid)
  833. {
  834. return 1;
  835. }
  836.  
  837. public OnPlayerEnterRaceCheckpoint(playerid)
  838. {
  839. return 1;
  840. }
  841.  
  842. public OnPlayerLeaveRaceCheckpoint(playerid)
  843. {
  844. return 1;
  845. }
  846.  
  847. public OnRconCommand(cmd[])
  848. {
  849. return 1;
  850. }
  851.  
  852. public OnPlayerRequestSpawn(playerid)
  853. {
  854. return 1;
  855. }
  856.  
  857. public OnObjectMoved(objectid)
  858. {
  859. return 1;
  860. }
  861.  
  862. public OnPlayerObjectMoved(playerid, objectid)
  863. {
  864. return 1;
  865. }
  866.  
  867. public OnPlayerPickUpPickup(playerid, pickupid)
  868. {
  869. return 1;
  870. }
  871.  
  872. public OnVehicleMod(playerid, vehicleid, componentid)
  873. {
  874. return 1;
  875. }
  876.  
  877. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  878. {
  879. return 1;
  880. }
  881.  
  882. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  883. {
  884. return 1;
  885. }
  886.  
  887. public OnPlayerSelectedMenuRow(playerid, row)
  888. {
  889. return 1;
  890. }
  891.  
  892. public OnPlayerExitedMenu(playerid)
  893. {
  894. return 1;
  895. }
  896.  
  897. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  898. {
  899. return 1;
  900. }
  901.  
  902. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  903. {
  904. return 1;
  905. }
  906.  
  907. public OnRconLoginAttempt(ip[], password[], success)
  908. {
  909. return 1;
  910. }
  911.  
  912. public OnPlayerUpdate(playerid)
  913. {
  914. return 1;
  915. }
  916.  
  917. public OnPlayerStreamIn(playerid, forplayerid)
  918. {
  919. return 1;
  920. }
  921.  
  922. public OnPlayerStreamOut(playerid, forplayerid)
  923. {
  924. return 1;
  925. }
  926.  
  927. public OnVehicleStreamIn(vehicleid, forplayerid)
  928. {
  929. return 1;
  930. }
  931.  
  932. public OnVehicleStreamOut(vehicleid, forplayerid)
  933. {
  934. return 1;
  935. }
  936.  
  937. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  938. {
  939. return 1;
  940. }
  941.  
  942. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  943. {
  944. return 1;
  945. }
  946. public OnPlayerModelSelection(playerid, response, listid, modelid)
  947. {
  948. if(listid == skinlist)
  949. {
  950. if(response)
  951. {
  952. new skinid,id,name[MAX_PLAYER_NAME],targetname[MAX_PLAYER_NAME],string[128];
  953. GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  954. GetPlayerName(id, targetname, MAX_PLAYER_NAME);
  955. SetPlayerSkin(id,modelid);
  956. skinid = GetPlayerSkin(id);
  957. format(string, 128, "* Admin %s has set your skinid to skinid %d.", name, skinid);
  958. SendClientMessage(id, COLOR_LIGHTBLUE, string);
  959. format(string, 128, "* You have set player %s their skinid to %d.", targetname, skinid);
  960. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  961. PlayerInfo[id][pSkin] = skinid;
  962. }
  963. else SendClientMessage(playerid, 0xFF0000FF, "Canceled skin selection");
  964. return 1;
  965. }
  966. if(listid == vehlist)
  967. {
  968. if(response)
  969. {
  970. new Float:X, Float:Y, Float:Z, Float:A;
  971. GetPlayerPos(playerid, X,Y,Z);
  972. GetPlayerFacingAngle(playerid,A);
  973. new carid = CreateVehicle(modelid, X,Y,Z,A,162,0, -1);
  974. PutPlayerInVehicle(playerid,carid, 0);
  975. LinkVehicleToInterior(carid,GetPlayerInterior(playerid));
  976. }
  977. else SendClientMessage(playerid, 0xFF0000FF, "Canceled vehicle selection");
  978. return 1;
  979. }
  980. return 1;
  981. }
  982. //______________ADMIN COMMANDS____________________
  983. CMD:ah(playerid, params[]) return cmd_ahelp(playerid, params);
  984.  
  985. CMD:ahelp(playerid, params[])
  986. {
  987. new alevel = PlayerInfo[playerid][pAdmin];
  988.  
  989. if(PlayerInfo[playerid][pAdmin] >= 1)
  990. {
  991. SendClientMessage(playerid, COLOR_GREEN,"____________________________________________");
  992. if(alevel >= 1)
  993. {
  994. SendClientMessage(playerid, COLOR_GRAD1, "1 Moderator: (/ah)elp");
  995. }
  996. if(alevel >= 2)
  997. {
  998. SendClientMessage(playerid, COLOR_GRAD2, "2 Junior Admin: /kick /ban /goto /sendtols /gotols /spawn");
  999. }
  1000. if(alevel >= 3)
  1001. {
  1002. SendClientMessage(playerid, COLOR_GRAD3, "3 General Admin: /noooc /setskin /givegun /gotoint");
  1003. }
  1004. if(alevel >= 4)
  1005. {
  1006. SendClientMessage(playerid, COLOR_GRAD4, "4 Senior Admin: /veh /sethp /setarmor /givemoney");
  1007. }
  1008. if(alevel >= 1337)
  1009. {
  1010. SendClientMessage(playerid, COLOR_GRAD5, "1337+ Admin: /rac ");
  1011. }
  1012. if(alevel >= 99999)
  1013. {
  1014. SendClientMessage(playerid, COLOR_GRAD5, "99999+ Executive Admin: /makeadmin");
  1015. }
  1016. if(IsPlayerAdmin(playerid))
  1017. {
  1018. SendClientMessage(playerid, COLOR_GRAD5, "RCON Admin: /rcon cmdlist");
  1019. }
  1020. SendClientMessage(playerid, COLOR_GREEN,"____________________________________________");
  1021. }
  1022. else SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN);
  1023. return 1;
  1024. }
  1025.  
  1026. CMD:veh(playerid, params[])
  1027. {
  1028. if(PlayerInfo[playerid][pAdmin] <=4) return SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN);
  1029. if(IsPlayerInAnyVehicle(playerid)) return RemovePlayerFromVehicle(playerid);
  1030. ShowModelSelectionMenu(playerid, vehlist, "Vehicle");
  1031.  
  1032. return 1;
  1033. }
  1034. CMD:vehx(playerid, params[])
  1035. {
  1036. if(PlayerInfo[playerid][pAdmin] <=4) return SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN);
  1037. if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You must be inside a vehicle to destroy it.");
  1038. new testcar= GetPlayerVehicleID(playerid);
  1039. SendClientMessage(playerid, 0xFFFFFFFF, "You have deleted a car!!");
  1040. DestroyVehicle(testcar);
  1041. return 1;
  1042. }
  1043. CMD:setadminname(playerid, params[])
  1044. {
  1045. new giveplayerid, name[56], str[126];
  1046. if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
  1047. if(sscanf(params, "us[56]", giveplayerid, name)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /setadminname [playerid/partofname] [name]");
  1048. if(PlayerInfo[giveplayerid][pAdmin] < 1)
  1049. {
  1050. SendClientMessage(playerid, COLOR_WHITE, "The player is not an admin.");
  1051. return 1;
  1052. }
  1053. if(AdminDuty[giveplayerid] == 1)
  1054. {
  1055. SendClientMessage(playerid, COLOR_WHITE, "That admin is currently on-duty. They must go off-duty in order for you to set their admin name.");
  1056. return 1;
  1057. }
  1058.  
  1059. new length = strlen(name);
  1060. if(length < 3 || length > 20)
  1061. {
  1062. SendClientMessage(playerid, COLOR_WHITE, "The name can't less than 3 characters or more than 20 characters.");
  1063. return 1;
  1064. }
  1065.  
  1066. if(strfind(name, "_", true) != -1)
  1067. {
  1068. SendClientMessage(playerid, COLOR_WHITE, "The admin name must be one name. There can't be an underscore in the name.");
  1069. return 1;
  1070. }
  1071. format(str, 126, "AdmCmd: %s has set %s's admin-name to %s.", GetName(playerid), GetName(giveplayerid), name);
  1072. SendClientMessageToAdmins(COLOR_LIGHTRED, str, 1);
  1073. format(PlayerInfo[giveplayerid][pAName], 56, name);
  1074. return 1;
  1075. }
  1076. CMD:aduty(playerid, params[])
  1077. {
  1078. new str[126];
  1079. if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN);
  1080. if(AdminDuty[playerid] != 1)
  1081. {
  1082. PlayerInfo[playerid][pCash] = GetPlayerCash(playerid); //This
  1083. SetPlayerHealth(playerid,99999);
  1084. SetPlayerArmour(playerid,99999);
  1085. if(isnull(PlayerInfo[playerid][pAName])) return SendClientMessage(playerid, -1, "You don't have an admin name.");
  1086. AdminDuty[playerid] = 1;
  1087. format(str, sizeof(str), "%s (ID %i - %s) is now on duty as a level %i admin.", PlayerInfo[playerid][pAName], playerid, GetName(playerid), PlayerInfo[playerid][pAdmin]);
  1088. SendClientMessageToAdmins(-1, str, 1);
  1089. SetPlayerName(playerid, PlayerInfo[playerid][pAName]);
  1090. SendClientMessage(playerid, -1, "You are now on duty as an admin, you do now have access to all of your commands.");
  1091. GetPlayerPos(playerid, PlayerInfo[playerid][pAx], PlayerInfo[playerid][pAy], PlayerInfo[playerid][pAz]);
  1092. }
  1093. else
  1094. {
  1095. TogglePlayerSpectating(playerid, false);
  1096. SetCameraBehindPlayer(playerid);
  1097. AdminDuty[playerid] = 0;
  1098. SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pLastX], PlayerInfo[playerid][pLastY], PlayerInfo[playerid][pLastZ], 0, 0, 0, 0, 0, 0, 0);
  1099. SpawnPlayer(playerid);
  1100. SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
  1101. ResetSetPlayerCash(playerid); //This
  1102. GivePlayerCash(playerid, PlayerInfo[playerid][pCash]);
  1103. SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVW]);
  1104. SetPlayerScore(playerid,PlayerInfo[playerid][pLevel]);
  1105. SetPlayerHealth(playerid,PlayerInfo[playerid][pHealth]);
  1106. SetPlayerArmour(playerid,PlayerInfo[playerid][pArmour]);
  1107. SetPlayerName(playerid, PlayerInfo[playerid][pName]);
  1108. new string[126];
  1109. format(string, 126, "%s Old cash: %i - New cash: %i", GetName(playerid), PlayerInfo[playerid][pCash], aCash);
  1110. AdminLog(string);
  1111. PlayerInfo[playerid][pCash] = aCash[playerid];
  1112. SetPlayerPos(playerid, PlayerInfo[playerid][pAx], PlayerInfo[playerid][pAy], PlayerInfo[playerid][pAz]);
  1113. format(str, sizeof(str), "%s (ID %i - %s) is now off admin duty.", PlayerInfo[playerid][pAName], playerid, GetName(playerid));
  1114. SendClientMessageToAdmins(-1, str, 1);
  1115. SendClientMessage(playerid, -1, "You are now off duty as an admin and have only a limited access to your commands.");
  1116. spec[playerid] = -1;
  1117. }
  1118. return 1;
  1119. }
  1120. /*CMD:setlevel(playerid, params[])
  1121. (
  1122. new level, id;
  1123. if (sscanf(params, "ui", id,level)) return SendClientMessage(playerid, -1,"USAGE: /setlevel [playerid/PartOfName] [level 1-99999]");
  1124. SetPlayerScore(playerid,GetPlayerScore(id) + level);
  1125. return 1;
  1126. }*/
  1127. CMD:makeadmin(playerid, params[])
  1128. {
  1129. new pID, value;
  1130.  
  1131. if(PlayerInfo[playerid][pAdmin] < 99999 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN);
  1132. else if (sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, -1,"USAGE: /makeadmin [playerid/PartOfName] [level 1-99999]");
  1133. else if (value < 0 || value > 99999) return SendClientMessage(playerid, COLOR_GRAD2, "Invalid level specified !(1-99999)");
  1134. else if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GRAD2,"Invalid player specified !");
  1135. else
  1136. {
  1137. new tName[MAX_PLAYER_NAME], string[128];
  1138. new rand = random(9999);
  1139. GetPlayerName(pID, tName, MAX_PLAYER_NAME);
  1140. strreplace(tName, '_', ' ');
  1141. gAdminAuthorized[pID] = 1;
  1142. PlayerInfo[pID][pSecKey] = rand;
  1143. format(string, sizeof(string), "* You've promoted %s to an level %d Administrator.", tName, value);
  1144. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1145. format(string, sizeof(string), "* You've been promoted to an level %d Administrator by %s, your security key is %d.", value, GetName(playerid), PlayerInfo[pID][pSecKey]);
  1146. SendClientMessage(pID, COLOR_LIGHTBLUE, string);
  1147. printf("AdmCmd: %s has promoted %s to a level %d admin.", GetName(playerid), tName, value);
  1148. PlayerInfo[pID][pAdmin] = value;
  1149. }
  1150. return 1;
  1151. }
  1152.  
  1153. CMD:noooc(playerid, params[])
  1154. {
  1155.  
  1156. if(PlayerInfo[playerid][pAdmin] >= 3)
  1157. {
  1158. if(PlayerInfo[playerid][pAdmin] >= 3 && (!noooc))
  1159. {
  1160. noooc = 1;
  1161. SendClientMessageToAll(COLOR_GRAD2, "OOC chat channel disabled by an Admin !");
  1162. }
  1163. else if(PlayerInfo[playerid][pAdmin] >= 3 && (noooc))
  1164. {
  1165. noooc = 0;
  1166. SendClientMessageToAll(COLOR_GRAD2, "OOC chat channel enabled by an Admin !");
  1167. }
  1168. }
  1169. else return SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN);
  1170. return 1;
  1171. }
  1172.  
  1173. CMD:kick(playerid,params[])
  1174. {
  1175.  
  1176. new id,name1[MAX_PLAYER_NAME], reason[35], string[128], logstring[256];
  1177. if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GRAD2,NOTADMIN);
  1178. else if(sscanf(params,"uz",id,reason)) return SendClientMessage(playerid, COLOR_WHITE,"USAGE: /kick [playerid/PartOfName] [reason]");
  1179. else if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_GREY,"Invalid player specified !");
  1180. else if(PlayerInfo[id][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_GRAD2, " You can't ban higher level administrators !");
  1181. else
  1182. {
  1183. new year, month, day;
  1184. getdate(year, month, day);
  1185. GetPlayerName(id,name1,sizeof(name1));
  1186. format(string, sizeof(string),"AdmCmd: %s has been kicked by %s, reason: %s",name1, GetName(playerid), reason);
  1187. SendClientMessageToAll(COLOR_LIGHTRED,string);
  1188. Kick(id);
  1189. format(logstring, sizeof(logstring), "AdmCmd: %s was kicked by %s, reason: %s (%d-%d-%d).", name1, GetName(playerid), reason, month, day, year);
  1190. KickLog(logstring);
  1191. }
  1192. return 1;
  1193. }
  1194.  
  1195. CMD:ban(playerid, params[])
  1196. {
  1197.  
  1198. new id, reason[35], name2[MAX_PLAYER_NAME], name1[MAX_PLAYER_NAME], string[128];
  1199. if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GRAD2,NOTADMIN);
  1200. if(sscanf(params,"uz", id, reason)) return SendClientMessage(playerid, COLOR_WHITE,"USAGE: /ban [playerid/PartOfName] [Reason]");
  1201. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY,"Invalid player specified !");
  1202. else
  1203. {
  1204. if(PlayerInfo[id][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_GRAD2, " You can't ban higher level administrators !");
  1205. new year, month, day;
  1206. new logstring[256];
  1207. getdate(year, month, day);
  1208. GetPlayerName(id, name2, sizeof(name2));
  1209. GetPlayerName(playerid, name1, sizeof(name1));
  1210. format(string, sizeof(string), "AdmCmd: %s has been banned by %s, reason: %s", name2, GetName(playerid), reason);
  1211. format(logstring, sizeof(logstring), "AdmCmd: %s was kicked by %s, reason: %s (%d-%d-%d).", name2, GetName(playerid), reason, month, day, year);
  1212. BanLog(logstring);
  1213. SendClientMessageToAll(COLOR_LIGHTRED, string);
  1214. new plrIP[16];
  1215. GetPlayerIp(id,plrIP, sizeof(plrIP));
  1216. SendClientMessage(id,COLOR_YELLOW,"|___________[BAN INFO]___________|");
  1217. format(string, sizeof(string), "Your name: %s.",name2);
  1218. SendClientMessage(id, COLOR_WHITE, string);
  1219. format(string, sizeof(string), "Your IP: %s.",plrIP);
  1220. SendClientMessage(id, COLOR_WHITE, string);
  1221. format(string, sizeof(string), "Who banned you: %s.",name1);
  1222. SendClientMessage(id, COLOR_WHITE, string);
  1223. format(string, sizeof(string), "Reason: %s.",reason);
  1224. SendClientMessage(id, COLOR_WHITE, string);
  1225. SendClientMessage(id,COLOR_YELLOW,"|___________[BAN INFO]___________|");
  1226. format(string,sizeof(string),"Please take a screenshot of this message (F8) and include it in your ban appeal.",GetName(playerid));
  1227. SendClientMessage(playerid, COLOR_YELLOW,string);
  1228. Ban(id);
  1229. }
  1230. return 1;
  1231. }
  1232.  
  1233. CMD:goto(playerid, params[])
  1234. {
  1235. new ID;
  1236. if(PlayerInfo[playerid][pAdmin] >= 2)
  1237. {
  1238. if(sscanf(params, "u", ID)) SendClientMessage(playerid, -1, "USAGE: /goto [playerid]");//checks if you have written something after /goto if no it sends error
  1239. else if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, COLOR_GRAD2, "Invalid player specified !");
  1240. else if(playerid == ID) return SendClientMessage(playerid, COLOR_GRAD2, "You can't goto yourself !");//checks if the player you are teleporting to is connected or if it is yourself if yes then comes an error
  1241. else//ELSE what will happen if no errors
  1242. {
  1243. new pinterior = GetPlayerInterior(ID);
  1244. new Float:x, Float:y, Float:z;//creates new floats
  1245. GetPlayerPos(ID, x, y, z);//gets the player id(which we have entered after /goto position and like saves them into x,y,z defined above as floats
  1246. SetPlayerPos(playerid, x+1, y+1, z);//sets the player position the id of that player +1 in x +1 in y and z remains same as it defines height
  1247. SetPlayerInterior(playerid, pinterior);
  1248. }
  1249. }
  1250. else return SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN);
  1251. return 1;
  1252. }
  1253.  
  1254. CMD:gotols(playerid, params[])
  1255. {
  1256. if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN);
  1257. else
  1258. {
  1259. PlayerInfo[playerid][pInt] = 0;
  1260. SetPlayerInterior(playerid, 0);
  1261. SetPlayerPos(playerid, 1529.6, -1691.2, 13.3);
  1262. SendClientMessage(playerid, COLOR_GRAD1, " You have been teleported to Los Santos!");
  1263. }
  1264. return 1;
  1265. }
  1266.  
  1267. CMD:givegun(playerid, params[])
  1268. {
  1269. if(PlayerInfo[playerid][pAdmin] >= 3)
  1270. {
  1271. new target, gun, string[128];
  1272. if(sscanf(params, "ud", target, gun))
  1273. {
  1274. SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givegun [playerid] [weaponid]");
  1275. SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
  1276. SendClientMessage(playerid, COLOR_GRAD1, "1: Brass Knuckles 2: Golf Club 3: Nite Stick 4: Knife 5: Baseball Bat 6: Shovel 7: Pool Cue 8: Katana 9: Chainsaw");
  1277. SendClientMessage(playerid, COLOR_GRAD2, "10: Purple Dildo 11: Small White Vibrator 12: Large White Vibrator 13: Silver Vibrator 14: Flowers 15: Cane 16: Frag Grenade");
  1278. SendClientMessage(playerid, COLOR_GRAD3, "17: Tear Gas 18: Molotov Cocktail 19: Vehicle Missile 20: Hydra Flare 21: Jetpack 22: 9mm 23: Silenced 9mm 24: Deagle 25: Shotgun");
  1279. SendClientMessage(playerid, COLOR_GRAD4, "26: Sawnoff Shotgun 27: Combat Shotgun 28: Micro SMG (Mac 10) 29: SMG (MP5) 30: AK-47 31: M4 32: Tec9 33: Country Rifle");
  1280. SendClientMessage(playerid, COLOR_GRAD5, "34: Sniper Rifle 35: Rocket Launcher 36: HS Rocket Launcher 37: Flamethrower 38: Minigun 39: Satchel Charge");
  1281. SendClientMessage(playerid, COLOR_GRAD6, "40: Detonator 41: Spraycan 42: Fire Extinguisher 43: Camera 44: Nightvision Goggles 45: Infared Goggles 46: Parachute");
  1282. SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
  1283. return 1;
  1284. }
  1285. if(gun < 1 || gun > 46) { SendClientMessage(playerid, COLOR_GREY, "Don't go below 1 or above 47."); return 1; }
  1286. if(IsPlayerConnected(target))
  1287. {
  1288. if(target != INVALID_PLAYER_ID)
  1289. {
  1290. if(gun == 21)
  1291. {
  1292. SetPlayerSpecialAction(target, SPECIAL_ACTION_USEJETPACK);
  1293. }
  1294. GivePlayerWeapon(target, gun, 999999);
  1295. format(string, sizeof(string), " You have given gun %d to %s!", gun, GetName(target));
  1296. SendClientMessage(playerid, COLOR_GRAD1, string);
  1297. }
  1298. }
  1299. }
  1300. else
  1301. {
  1302. SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
  1303. return 1;
  1304. }
  1305. return 1;
  1306. }
  1307.  
  1308. CMD:gotoint(playerid, params[])
  1309. {
  1310. new Interior, Float: X, Float: Y, Float: Z;
  1311. if( sscanf( params, "dfff", Interior, X, Y, Z ) )
  1312. {
  1313. if (PlayerInfo[playerid][pAdmin] >= 4)
  1314. {
  1315. SendClientMessage( playerid, COLOR_WHITE, "USAGE: /gotoint [Interior ID] [x point] [y point] [z point]" );
  1316. }
  1317. }
  1318. else
  1319. {
  1320. if (PlayerInfo[playerid][pAdmin] >= 4)
  1321. {
  1322. SetPlayerPos( playerid, X, Y, Z );
  1323. SetPlayerInterior( playerid, Interior );
  1324. SendClientMessage( playerid, COLOR_GRAD2, "You have been teleported to the defined position !" );
  1325. }
  1326. }
  1327. return 1;
  1328. }
  1329.  
  1330. CMD:rac(playerid, params[])
  1331. {
  1332. if(PlayerInfo[playerid][pAdmin] >= 1337)
  1333. {
  1334. SendClientMessageToAll(COLOR_GRAD2, "SERVER: An admin has initiated an all vehicle respawn !");
  1335. for(new i = 1; i <= MAX_VEHICLES; i++)
  1336. {
  1337. SetVehicleToRespawn(i);
  1338. }
  1339. }
  1340. else return SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN);
  1341. return 1;
  1342. }
  1343.  
  1344. CMD:givemoney(playerid, params[])
  1345. {
  1346. if (PlayerInfo[playerid][pAdmin] >= 4)
  1347. {
  1348. new string[128], giveplayerid, money;
  1349. if(sscanf(params, "ui", giveplayerid, money)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givemoney [playerid] [money]");
  1350.  
  1351. if(IsPlayerConnected(giveplayerid))
  1352. {
  1353. GivePlayerMoney(giveplayerid, money);
  1354. format(string, sizeof(string), "* You have set %s's cash to an amount of $%d.",GetName(giveplayerid),money);
  1355. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1356. PlayerInfo[playerid][pCash] += money;
  1357. new ip[32], ipex[32];
  1358. new i_dateTime[2][3];
  1359. gettime(i_dateTime[0][0], i_dateTime[0][1], i_dateTime[0][2]);
  1360. getdate(i_dateTime[1][0], i_dateTime[1][1], i_dateTime[1][2]);
  1361. GetPlayerIp(playerid, ip, sizeof(ip));
  1362. GetPlayerIp(giveplayerid, ipex, sizeof(ipex));
  1363. format(string, sizeof(string), "[%i/%i/%i - %i:%i:%i] %s (IP:%s) has paid $%d to %s (IP:%s)", i_dateTime[1][0], i_dateTime[1][1], i_dateTime[1][2], i_dateTime[0][0], i_dateTime[0][1], i_dateTime[0][2], GetName(playerid), ip, money, GetName(giveplayerid), ipex);
  1364. PayLog(string);
  1365.  
  1366.  
  1367. }
  1368. }
  1369. else
  1370. {
  1371. SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
  1372. }
  1373. return 1;
  1374. }
  1375.  
  1376. CMD:setarmor(playerid, params[])
  1377. {
  1378. new string[128], playa, health;
  1379. if(sscanf(params, "ud", playa, health))
  1380. {
  1381. SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setarmor [playerid] [armor]");
  1382. return 1;
  1383. }
  1384. if(PlayerInfo[playa][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_GRAD2, " You can't set higher level administrator's armor !");
  1385. if (PlayerInfo[playerid][pAdmin] >= 4)
  1386. {
  1387. if(IsPlayerConnected(playa))
  1388. {
  1389. if(playa != INVALID_PLAYER_ID)
  1390. {
  1391. SetPlayerArmour(playa, health);
  1392. format(string, sizeof(string), "* You have set %s's armor to %d.", GetName(playa), health);
  1393. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1394. }
  1395. }
  1396. }
  1397. else
  1398. {
  1399. SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
  1400. }
  1401. return 1;
  1402. }
  1403.  
  1404.  
  1405. CMD:sethp(playerid, params[])
  1406. {
  1407. new string[128], playa, health;
  1408. if(sscanf(params, "ud", playa, health))
  1409. {
  1410. SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sethp [playerid] [health]");
  1411. return 1;
  1412. }
  1413. if(PlayerInfo[playa][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_GRAD2, " You can't set higher level administrator's HP !");
  1414. if (PlayerInfo[playerid][pAdmin] >= 4) {
  1415. if(IsPlayerConnected(playa)) {
  1416. if(playa != INVALID_PLAYER_ID)
  1417. {
  1418. SetPlayerHealth(playa, health);
  1419. format(string, sizeof(string), "* You have set %s's health to %d.", GetName(playa), health);
  1420. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1421. }
  1422. }
  1423. else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified.");
  1424. }
  1425. else {
  1426. SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
  1427. }
  1428. return 1;
  1429. }
  1430.  
  1431. CMD:setskin(playerid, params[])
  1432. {
  1433. new id;
  1434. if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN);
  1435. else if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "USAGE: /setskin [playerid]");
  1436. if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Invalid player specified !");
  1437. ShowModelSelectionMenu(playerid, skinlist, "Select Skin");
  1438. return 1;
  1439. }
  1440.  
  1441. CMD:spawn(playerid, params[])
  1442. {
  1443. new ID;
  1444. if(PlayerInfo[playerid][pAdmin] >= 2)
  1445. {
  1446. if(sscanf(params, "u", ID)) SendClientMessage(playerid, -1, "USAGE: /spawn [playerid]");//checks if you have written something after /goto if no it sends error
  1447. else if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, COLOR_GRAD2, "Invalid player specified !");
  1448. else//ELSE what will happen if no errors
  1449. {
  1450. SetPlayerPos(ID, 982.1890, -1624.2583, 14.9526);
  1451. SetPlayerFacingAngle(ID, 90);
  1452. SetPlayerInterior(ID, 0);
  1453. }
  1454. }
  1455. else return SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN);
  1456. return 1;
  1457. }
  1458.  
  1459. CMD:gethere(playerid,params[])
  1460. {
  1461. if(PlayerInfo[playerid][pAdmin] >= 2)
  1462. {
  1463. new targetid, Float:x, Float:y, Float:z;//defines floats and [U]targetid(same which we did as id above)[/U]
  1464. new vw = GetPlayerVirtualWorld(playerid);
  1465. if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gethere [playerid]");//checks if there is something written after /gethere if no sends the usage error
  1466. else if(playerid == targetid) return SendClientMessage(playerid, COLOR_GRAD2, "You are already at yourself !");
  1467. if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GRAD2, "Invalid player specified !");//checks if the player you are teleporting to is conne not teleporting ourselves to our self :P if we are it sends error
  1468. new interior = GetPlayerInterior(playerid);
  1469. GetPlayerPos(playerid, x, y, z);//gets player pos PLAYER POS not targetid
  1470. SetPlayerPos(targetid, x+1, y+1, z);
  1471. GetPlayerVirtualWorld(playerid);
  1472. SetPlayerVirtualWorld(targetid, vw);
  1473. SetPlayerInterior(targetid, interior);
  1474. }
  1475. else return SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN);
  1476. return 1;
  1477. }
  1478.  
  1479. //____________________________________________________________
  1480.  
  1481.  
  1482. //___________________PLAYER COMMANDS_____________________
  1483. CMD:help(playerid, params[])
  1484. {
  1485. SendClientMessage(playerid, COLOR_WHITE,"*** CHAT *** (/w)hisper (/o)oc (/s)hout (/l)ow /b /me /do /togwhisper");
  1486. SendClientMessage(playerid, COLOR_WHITE,"*** GENERAL *** /pay /time /id /kill");
  1487. return 1;
  1488. }
  1489.  
  1490. CMD:sendtols(playerid, params[])
  1491. {
  1492. new id;
  1493.  
  1494. if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN);
  1495. if(sscanf(params,"u", id)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sendtols [playerid/PartOfName]");
  1496. if(id != INVALID_PLAYER_ID)
  1497. {
  1498. PlayerInfo[id][pInt] = 0;
  1499. SetPlayerInterior(id, 0);
  1500. SetPlayerVirtualWorld(id, 0);
  1501. SetPlayerPos(id, 1529.6, -1691.2, 13.3);
  1502. SendClientMessage(id, COLOR_GRAD1, " You have been teleported !");
  1503. }
  1504. else return SendClientMessage(playerid, COLOR_GRAD2, "Invalid player specified !");
  1505. return 1;
  1506. }
  1507.  
  1508. CMD:kill(playerid, params[])
  1509. {
  1510. SetPlayerHealth(playerid, 0);
  1511. ResetPlayerWeapons(playerid);
  1512. return 1;
  1513. }
  1514. CMD:hkill(playerid, params[])
  1515. {
  1516. SetPlayerHealth(playerid, 50);
  1517. ResetPlayerWeapons(playerid);
  1518. return 1;
  1519. }
  1520.  
  1521.  
  1522. CMD:id(playerid, params[])
  1523. {
  1524. new string[128], giveplayerid;
  1525.  
  1526. if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /id [playerid]");
  1527.  
  1528. if(IsPlayerConnected(giveplayerid))
  1529. {
  1530. format(string, sizeof(string), "(ID: %d) - (Name: %s) - (Level: %d) - (Ping: %d)", giveplayerid, GetName(giveplayerid), PlayerInfo[giveplayerid][pLevel], GetPlayerPing(giveplayerid));
  1531. SendClientMessage(playerid, COLOR_WHITE, string);
  1532. }
  1533. else
  1534. {
  1535. SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified !");
  1536. }
  1537. return 1;
  1538. }
  1539.  
  1540. CMD:time(playerid, params[])
  1541. {
  1542. new string[128];
  1543. new mtext[20];
  1544. new year, month,day;
  1545. getdate(year, month, day);
  1546.  
  1547. if(month == 1) { mtext = "January"; }
  1548. else if(month == 2) { mtext = "February"; }
  1549. else if(month == 3) { mtext = "March"; }
  1550. else if(month == 4) { mtext = "April"; }
  1551. else if(month == 5) { mtext = "May"; }
  1552. else if(month == 6) { mtext = "June"; }
  1553. else if(month == 7) { mtext = "July"; }
  1554. else if(month == 8) { mtext = "August"; }
  1555. else if(month == 9) { mtext = "September"; }
  1556. else if(month == 10) { mtext = "October"; }
  1557. else if(month == 11) { mtext = "November"; }
  1558. else if(month == 12) { mtext = "December"; }
  1559. new hour,minuite,second;
  1560. gettime(hour,minuite,second);
  1561. FixHour(hour);
  1562. hour = shifthour;
  1563. if(minuite < 10)
  1564. {
  1565. format(string, sizeof(string), "~y~%d %s~n~~g~|~w~%d:0%d~g~|", day, mtext, hour, minuite);
  1566. }
  1567. else
  1568. {
  1569. format(string, sizeof(string), "~y~%d %s~n~~g~|~w~%d:%d~g~|", day, mtext, hour, minuite);
  1570. }
  1571. if(!IsPlayerInAnyVehicle(playerid))
  1572. {
  1573. GameTextForPlayer(playerid, string, 5000, 1);
  1574. ApplyAnimation(playerid, "COP_AMBIENT", "Coplook_watch",4.0,0,0,0,0,0);
  1575. }
  1576. else
  1577. {
  1578. GameTextForPlayer(playerid, string, 5000, 1);
  1579. }
  1580. return 1;
  1581. }
  1582.  
  1583.  
  1584. CMD:pay(playerid, params[])
  1585. {
  1586. new
  1587. iTargetID, iCashAmount;
  1588.  
  1589.  
  1590. if(sscanf(params, "ui", iTargetID, iCashAmount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pay [playerid] [amount]");
  1591.  
  1592. if(iTargetID == playerid)
  1593. {
  1594. SendClientMessage(playerid, COLOR_GRAD1, "You can not use this command on yourself !");
  1595. return 1;
  1596. }
  1597. if(iCashAmount > 1000 && PlayerInfo[playerid][pLevel] < 2)
  1598. {
  1599. SendClientMessage(playerid, COLOR_GRAD1, "You must be level 2 to pay over $1,000 !");
  1600. return 1;
  1601. }
  1602. if(iCashAmount < 1 || iCashAmount > 10000)
  1603. {
  1604. SendClientMessage(playerid, COLOR_GRAD1, "Don't go below $1, or above $10,000 at once !");
  1605. return 1;
  1606. }
  1607. if (IsPlayerConnected(iTargetID))
  1608. {
  1609. if (ProxDetectorS(5.0, playerid, iTargetID))
  1610. {
  1611. new
  1612. string[128], giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], playermoney = GetPlayerMoney(playerid);
  1613.  
  1614. giveplayer = GetName(iTargetID);
  1615. sendername = GetName(playerid);
  1616. if(GetPlayerMoney(playerid) < playermoney) return SendClientMessage(playerid, COLOR_GRAD1, " Invalid transaction amount.");
  1617. else
  1618. {
  1619. GivePlayerMoney(playerid, -iCashAmount);
  1620. GivePlayerMoney(iTargetID, iCashAmount);
  1621. format(string, sizeof(string), " You have paid $%d to %s.", iCashAmount, GetName(iTargetID));
  1622. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  1623. SendClientMessage(playerid, COLOR_GRAD1, string);
  1624. format(string, sizeof(string), " You have recieved $%d from %s.", iCashAmount, GetName(playerid));
  1625. SendClientMessage(iTargetID, COLOR_GRAD1, string);
  1626. new ip[32], ipex[32];
  1627. new i_dateTime[2][3];
  1628. gettime(i_dateTime[0][0], i_dateTime[0][1], i_dateTime[0][2]);
  1629. getdate(i_dateTime[1][0], i_dateTime[1][1], i_dateTime[1][2]);
  1630. GetPlayerIp(playerid, ip, sizeof(ip));
  1631. GetPlayerIp(iTargetID, ipex, sizeof(ipex));
  1632. format(string, sizeof(string), "[%i/%i/%i - %i:%i:%i] %s (IP:%s) has paid $%d to %s (IP:%s)", i_dateTime[1][0], i_dateTime[1][1], i_dateTime[1][2], i_dateTime[0][0], i_dateTime[0][1], i_dateTime[0][2], GetName(playerid), ip, iCashAmount, GetName(iTargetID), ipex);
  1633. PayLog(string);
  1634.  
  1635. if(PlayerInfo[playerid][pAdmin] >= 2)
  1636. {
  1637. format(string, sizeof(string), "[Admin] %s (IP:%s) has paid $%d to %s (IP:%s)", GetName(playerid), ip, iCashAmount, GetName(iTargetID), ipex);
  1638. format(string, sizeof(string), "AdmWarning: %s (IP:%s) has paid $%d to %s (IP:%s)", GetName(playerid), ip, iCashAmount, GetName(iTargetID), ipex);
  1639. ABroadCast(COLOR_YELLOW, string, 2);
  1640. }
  1641.  
  1642. PayWarn[playerid][iTargetID] += iCashAmount;
  1643. if(PayWarn[playerid][iTargetID] >= 100000 && PlayerInfo[playerid][pLevel] <= 3)
  1644. {
  1645. format(string, sizeof(string), "%s (IP:%s) has paid %s (IP:%s) $%d in this session.", GetName(playerid), ip, GetName(iTargetID), ipex, PayWarn[playerid][iTargetID]);
  1646. ABroadCast(COLOR_YELLOW, string, 2);
  1647. }
  1648.  
  1649. if(iCashAmount >= 1000000)
  1650. {
  1651. ABroadCast(COLOR_YELLOW,string,2);
  1652. }
  1653.  
  1654. PlayerPlaySound(iTargetID, 1052, 0.0, 0.0, 0.0);
  1655. format(string, sizeof(string), "* %s takes out some cash, and hands it to %s.", GetName(playerid) ,GetName(iTargetID));
  1656. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  1657. }
  1658. }
  1659. else
  1660. {
  1661. SendClientMessage(playerid, COLOR_GREY, "That player isn't near you.");
  1662. }
  1663. }
  1664. else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified.");
  1665. return 1;
  1666. }
  1667.  
  1668. CMD:togwhisper(playerid, params[])
  1669. {
  1670. if (!HidePM[playerid])
  1671. {
  1672. HidePM[playerid] = 1;
  1673. SendClientMessage(playerid, COLOR_GRAD2, "You have disabled whisper chat !");
  1674. }
  1675. else
  1676. {
  1677. HidePM[playerid] = 0;
  1678. SendClientMessage(playerid, COLOR_GRAD2, "You have enabled whisper chat !");
  1679. }
  1680. return 1;
  1681. }
  1682.  
  1683. CMD:low(playerid, params[]) {
  1684. return cmd_l(playerid, params);
  1685. }
  1686.  
  1687. CMD:l(playerid, params[])
  1688. {
  1689. if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/l)ow [quiet chat]");
  1690.  
  1691. new string[128];
  1692. format(string, sizeof(string), "%s says quietly: %s", GetName(playerid), params);
  1693. ProxDetector(5.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
  1694. format(string, sizeof(string), "(quietly) %s", params);
  1695. SetPlayerChatBubble(playerid,string,COLOR_WHITE,5.0,5000);
  1696. return 1;
  1697. }
  1698.  
  1699. CMD:w(playerid, params[]) {
  1700. return cmd_whisper(playerid, params);
  1701. }
  1702.  
  1703. CMD:whisper(playerid, params[])
  1704. {
  1705. new giveplayerid, whisper[128];
  1706.  
  1707. if(sscanf(params, "us[128]", giveplayerid, whisper))
  1708. {
  1709. SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/w)hisper [playerid] [message]");
  1710. return 1;
  1711. }
  1712. if (IsPlayerConnected(giveplayerid))
  1713. {
  1714. if(HidePM[giveplayerid] > 0)
  1715. {
  1716. SendClientMessage(playerid, COLOR_GREY, "That player is blocking whispers!");
  1717. return 1;
  1718. }
  1719. new giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], string[128];
  1720. sendername = GetName(playerid);
  1721. giveplayer = GetName(giveplayerid);
  1722. if(ProxDetectorS(5.0, playerid, giveplayerid) || PlayerInfo[playerid][pAdmin] >= 2)
  1723. {
  1724. format(string, sizeof(string), "%s(ID: %d) whispers: %s", GetName(playerid), playerid, whisper);
  1725. SendClientMessage(giveplayerid,COLOR_YELLOW, string);
  1726.  
  1727. format(string, sizeof(string), "Whisper to %s(ID: %d): %s", GetName(giveplayerid), giveplayerid, whisper);
  1728. SendClientMessage(playerid,COLOR_YELLOW, string);
  1729. return 1;
  1730. }
  1731. else
  1732. {
  1733. SendClientMessage(playerid, COLOR_GREY, "That player isn't near you !");
  1734. }
  1735. return 1;
  1736. }
  1737. else
  1738. {
  1739. SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified !");
  1740. }
  1741. return 1;
  1742. }
  1743.  
  1744. CMD:me(playerid, params[])
  1745. {
  1746.  
  1747. new string[128];
  1748. if(isnull(params)) return SendClientMessage(playerid,-1,"USAGE: /me [action]");
  1749. format(string, sizeof(string), "* %s %s", GetName(playerid), params);
  1750. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  1751. return 1;
  1752. }
  1753.  
  1754. CMD:do(playerid, params[])
  1755. {
  1756. new string[128];
  1757.  
  1758. if(isnull(params)) return SendClientMessage(playerid,-1,"USAGE: /do [local chat]");
  1759. format(string, sizeof(string), "* %s (( %s ))", params, GetName(playerid));
  1760. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  1761. return 1;
  1762. }
  1763.  
  1764. CMD:s(playerid,params[])
  1765. {
  1766. new string[128];
  1767.  
  1768. if(isnull(params)) return SendClientMessage(playerid,-1,"USAGE: (/s)hout [local chat]");
  1769. format(string, sizeof(string), "%s shouts: %s!", GetName(playerid), params);
  1770. ProxDetector(30.0, playerid, string,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_FADE1,COLOR_FADE2);
  1771. return 1;
  1772. }
  1773.  
  1774. CMD:shout(playerid, params[]) return cmd_s(playerid, params);
  1775.  
  1776. CMD:b(playerid,params[])
  1777. {
  1778.  
  1779. new string[128];
  1780. if(isnull(params)) return SendClientMessage(playerid, -1,"USAGE: /b [local ooc]");
  1781. format(string, sizeof(string), "%s: (( %s ))", GetName(playerid), params);
  1782. ProxDetector(30.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
  1783. return 1;
  1784. }
  1785.  
  1786. CMD:ooc(playerid, params[])
  1787. {
  1788. new string[160];
  1789.  
  1790. if(isnull(params)) return SendClientMessage(playerid, -1,"USAGE: /ooc [chat]");
  1791. if ((noooc) && PlayerInfo[playerid][pAdmin] < 1 && gOOC[playerid] == 0)
  1792. {
  1793. SendClientMessage(playerid, COLOR_GREY, "The OOC channel has been disabled by an Admin !");
  1794. return 1;
  1795. }
  1796. else
  1797. {
  1798. format(string,160,"(( %s: %s ))", GetName(playerid), params);
  1799. printf("(( %s: %s ))", GetName(playerid), string);
  1800. OOCOff(COLOR_OOC,string);
  1801. }
  1802. if(gOOC[playerid] == 1)
  1803. {
  1804. SendClientMessage(playerid, COLOR_GREY, "You have the channel toggled, /togooc to re-enable!");
  1805. return 1;
  1806. }
  1807. return 1;
  1808. }
  1809.  
  1810. CMD:o(playerid, params[]) return cmd_ooc(playerid, params);
  1811. CMD:mask(playerid, params[])
  1812. {
  1813. new string[128];
  1814. if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /mask [name]");
  1815. format(string, sizeof(string),"You've hide you name from %s to %s", GetName(playerid),string);
  1816. SetPlayerName(playerid,string);
  1817. return 1;
  1818. }
  1819. //___________________________________________________
  1820. public OnPlayerCommandPerformed(playerid, cmdtext[], success)
  1821. {
  1822. if(!success) SendClientMessage(playerid, COLOR_RED, "[SERVER]: Invalid command, please use the available commands in /help.");
  1823. else if(gPlayerLogged[playerid] == 0) { SendClientMessage(playerid, COLOR_GREY, "You're not logged in."); }
  1824. return 1;
  1825. }
Advertisement
Add Comment
Please, Sign In to add comment