Advertisement
Guest User

s

a guest
Mar 20th, 2013
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.85 KB | None | 0 0
  1. /*
  2.  
  3. Random:
  4. [added] [Pending Test] Player Spectating killer
  5. [added] [Working] reg & login + hash
  6. [added] [Working] textdraws upon login
  7. [not added] Range of the airport <- Player that goes out from the range of airport will be killed if not returned withing 5 seconds
  8.  
  9.  
  10. Perks:
  11. [not added] Camouflage <- set player Virtual world for % seconds (depending on the skill level)
  12. [not added] Hydra Damage <- Lower the hydra damage
  13. [not added] Shield <- Gives player 500 hp for 5 seconds
  14.  
  15. VIP Perks:
  16. [not added] Tags <- Player name tag for example [ClanName] PlayerName
  17. [not added] Private airports <- Private airports for clans
  18.  
  19. */
  20.  
  21.  
  22. #include <a_samp>
  23. #include <zcmd>
  24. #include <sscanf2>
  25. #include <a_samp>
  26. #include <YSI\y_ini>
  27.  
  28. #define dregister 2011
  29. #define dlogin 2012
  30. #define UserPath "Users/%s.ini"
  31.  
  32. #define WHITE 0xFFFFFFAA
  33. #define COL_WHITE "{FFFFFF}"
  34. #define COL_RED "{F81414}"
  35. #define COL_GREEN "{00FF22}"
  36. #define COL_LIGHTBLUE "{00CED1}"
  37. #define COLOR_GREY 0xAFAFAFAA
  38. #define COLOR_GREEN 0x33AA33AA
  39. #define COLOR_RED 0xAA3333AA
  40. #define COLOR_YELLOW 0xFFFF00AA
  41. #define COLOR_WHITE 0xFFFFFFAA
  42. #define COLOR_BLUE 0x0000BBAA
  43. #define COLOR_LIGHTBLUE 0x33CCFFAA
  44. #define COLOR_ORANGE 0xFF9900AA
  45. #define COLOR_RED 0xAA3333AA
  46. #define COLOR_LIME 0x10F441AA
  47. #define COLOR_MAGENTA 0xFF00FFFF
  48. #define COLOR_NAVY 0x000080AA
  49. #define COLOR_AQUA 0xF0F8FFAA
  50. #define COLOR_CRIMSON 0xDC143CAA
  51. #define COLOR_FLBLUE 0x6495EDAA
  52. #define COLOR_BISQUE 0xFFE4C4AA
  53. #define COL_WHITE "{FFFFFF}"
  54.  
  55.  
  56. enum PlayerInfo
  57. {
  58. Pass[129],
  59. Adminlevel,
  60. VIPlevel,
  61. Money,
  62. Scores,
  63. Kills,
  64. Deaths
  65. }
  66. new pInfo[MAX_PLAYERS][PlayerInfo];
  67.  
  68.  
  69. new Float:RandomSpawns[][] =
  70. {
  71. {365.4037,2538.4521,17.7501,181.8172},
  72. {385.4970,2540.7581,17.4408,182.9258},
  73. {354.6383,2550.2571,17.4602,175.3287},
  74. {426.9488,2513.3225,17.4129,94.4121},
  75. {426.5472,2502.2146,17.2314,98.5555},
  76. {420.2510,2489.5217,17.3957,98.3015},
  77. {327.9721,2540.6008,17.7368,181.5695},
  78. {292.7176,2545.1101,17.7518,178.5204}
  79. };
  80.  
  81.  
  82. new Text:Textdraw0;
  83. new Text:Textdraw1;
  84.  
  85. new Weather;
  86.  
  87. new PayCheck[MAX_PLAYERS];
  88.  
  89. native WP_Hash(buffer[],len,const str[]);
  90.  
  91.  
  92. forward GivePlayerCheck(playerid);
  93. forward spectateend(playerid);
  94. forward RandomWeather();
  95. forward exited(playerid);
  96.  
  97. #if defined FILTERSCRIPT
  98.  
  99.  
  100. #else
  101.  
  102.  
  103. main()
  104. {
  105. print("\n----------------------------------");
  106. print(" World Of War Planes");
  107. print("----------------------------------\n");
  108. }
  109.  
  110. #endif
  111.  
  112. public OnGameModeInit()
  113. {
  114. SetGameModeText("Blank Script");
  115. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  116.  
  117. SetTimer("RandomWeather",150000,true); // 15 minutes random weather
  118.  
  119.  
  120.  
  121. Textdraw0 = TextDrawCreate(680.000000, -52.000000, "BOX");
  122. TextDrawBackgroundColor(Textdraw0, 255);
  123. TextDrawFont(Textdraw0, 1);
  124. TextDrawLetterSize(Textdraw0, 2.799999, 21.100000);
  125. TextDrawColor(Textdraw0, -1);
  126. TextDrawSetOutline(Textdraw0, 0);
  127. TextDrawSetProportional(Textdraw0, 1);
  128. TextDrawSetShadow(Textdraw0, 1);
  129. TextDrawUseBox(Textdraw0, 1);
  130. TextDrawBoxColor(Textdraw0, 255);
  131. TextDrawTextSize(Textdraw0, -320.000000, -300.000000);
  132.  
  133. Textdraw1 = TextDrawCreate(1493.000000, 366.000000, "BOX");
  134. TextDrawBackgroundColor(Textdraw1, 255);
  135. TextDrawFont(Textdraw1, 1);
  136. TextDrawLetterSize(Textdraw1, 4.209998, 25.100000);
  137. TextDrawColor(Textdraw1, -1);
  138. TextDrawSetOutline(Textdraw1, 0);
  139. TextDrawSetProportional(Textdraw1, 1);
  140. TextDrawSetShadow(Textdraw1, 1);
  141. TextDrawUseBox(Textdraw1, 1);
  142. TextDrawBoxColor(Textdraw1, 255);
  143. TextDrawTextSize(Textdraw1, -90.000000, 0.000000);
  144. return 1;
  145. }
  146.  
  147. public OnGameModeExit()
  148. {
  149. return 1;
  150. }
  151.  
  152. public OnPlayerRequestClass(playerid, classid)
  153. {
  154. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  155. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  156. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  157. return 1;
  158. }
  159.  
  160. public OnPlayerConnect(playerid)
  161. {
  162. new name[MAX_PLAYER_NAME];
  163. GetPlayerName(playerid,name,sizeof(name));
  164. if(fexist(Path(playerid)))
  165. {// then
  166. INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
  167. ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login","Welcome back. This account is registered. \nInsert your password to login to your account","Login","Quit");
  168. }
  169. else
  170. {
  171. ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
  172. return 1;
  173. }
  174.  
  175. TextDrawShowForPlayer(playerid, Textdraw0);
  176. TextDrawShowForPlayer(playerid, Textdraw1);
  177. PayCheck[playerid]=SetTimerEx("GivePlayerCheck",600000,true,"i",playerid);
  178. return 1;
  179. }
  180.  
  181. public OnPlayerDisconnect(playerid, reason)
  182. {
  183. KillTimer(PayCheck[playerid]);
  184. if(fexist(Path(playerid)))
  185. {
  186. new INI:file = INI_Open(Path(playerid));
  187. INI_SetTag(file,"Player's Data");
  188. INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]);
  189. INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);
  190. INI_WriteInt(file,"Money",GetPlayerMoney(playerid));
  191. INI_WriteInt(file,"Scores",GetPlayerScore(playerid));
  192. INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);
  193. INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);
  194. INI_Close(file);
  195. return 1;
  196. }
  197. return 1;
  198. }
  199.  
  200. public OnPlayerSpawn(playerid)
  201. {
  202.  
  203. TextDrawHideForPlayer(playerid, Textdraw0);
  204. TextDrawHideForPlayer(playerid, Textdraw1);
  205.  
  206. new Random = random(sizeof(RandomSpawns));
  207. SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
  208. SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
  209.  
  210. return 1;
  211. }
  212.  
  213. public OnPlayerDeath(playerid, killerid, reason)
  214. {
  215. pInfo[killerid][Kills]++;
  216. pInfo[playerid][Deaths]++;
  217.  
  218. if ( killerid != INVALID_PLAYER_ID )
  219. {
  220. new szGameTextStr[128], killerName[24];
  221.  
  222. GetPlayerName(killerid,killerName,24);
  223. TogglePlayerSpectating( playerid, 1 );
  224. if (IsPlayerInAnyVehicle(killerid))
  225. {
  226. PlayerSpectateVehicle( playerid, GetPlayerVehicleID( killerid ) );
  227. }
  228. else
  229. {
  230. PlayerSpectatePlayer( playerid, killerid );
  231. }
  232. format( szGameTextStr, 128, "~w~~n~killCamera~n~~>~Killer: %s ( ID: %i )~<~", killerName, killerid );
  233. GameTextForPlayer( playerid, szGameTextStr, 10000, 5 );
  234. SetTimerEx( "spectateend", true, 10000, "i", playerid );
  235. TextDrawShowForPlayer(playerid, Textdraw0);
  236. TextDrawShowForPlayer(playerid, Textdraw1);
  237. }
  238.  
  239. GivePlayerMoney(killerid, 100);
  240. SendClientMessage(killerid, WHITE, "<!>You have killed an enemy, you received +100!");
  241. return 1;
  242. }
  243.  
  244. public OnVehicleSpawn(vehicleid)
  245. {
  246. return 1;
  247. }
  248.  
  249. public OnVehicleDeath(vehicleid, killerid)
  250. {
  251. return 1;
  252. }
  253.  
  254. public OnPlayerText(playerid, text[])
  255. {
  256. new Rank[20];
  257. switch(GetPlayerScore(playerid))
  258. {
  259. case 0 .. 10: format(Rank, sizeof(Rank),"[Officer Cadet]");
  260. case 11 .. 20: format(Rank, sizeof(Rank),"[Pilot officer]");
  261. case 21 .. 30: format(Rank, sizeof(Rank),"[Flying officer]");
  262. case 31 .. 40: format(Rank, sizeof(Rank),"[Flight lieutenant]");
  263. case 41 .. 50: format(Rank, sizeof(Rank),"[Squadron leader]");
  264. case 51 .. 60: format(Rank, sizeof(Rank),"[Wing commander]");
  265. case 61 .. 70: format(Rank, sizeof(Rank),"[Group captain]");
  266. case 71 .. 80: format(Rank, sizeof(Rank),"[Air commodore]");
  267. case 81 .. 90: format(Rank, sizeof(Rank),"[Air marshal]");
  268. case 91 .. 100: format(Rank, sizeof(Rank),"[Air Force Marshal]");
  269. }
  270. new ChatText[128], Nameasd[MAX_PLAYER_NAME];
  271. GetPlayerName(playerid, Nameasd, MAX_PLAYER_NAME);
  272. format(ChatText, sizeof(ChatText),"{F3FF02}%s %s:{FFFFFF} %s", Rank, Nameasd, text);
  273. SendClientMessageToAll(-1, ChatText);
  274. return 0;
  275. }
  276.  
  277. public OnPlayerCommandText(playerid, cmdtext[])
  278. {
  279. if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  280. {
  281. // Do something here
  282. return 1;
  283. }
  284. return 0;
  285. }
  286.  
  287. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  288. {
  289. return 1;
  290. }
  291.  
  292. public OnPlayerExitVehicle(playerid, vehicleid)
  293. {
  294. SendClientMessage(playerid, COLOR_RED, "<!>You have 5 seconds to get back into your vehicle!");
  295. SetTimerEx( "exited", true, 5000, "i", playerid );
  296. return 1;
  297. }
  298.  
  299. public OnPlayerStateChange(playerid, newstate, oldstate)
  300. {
  301. return 1;
  302. }
  303.  
  304. public OnPlayerEnterCheckpoint(playerid)
  305. {
  306. return 1;
  307. }
  308.  
  309. public OnPlayerLeaveCheckpoint(playerid)
  310. {
  311. return 1;
  312. }
  313.  
  314. public OnPlayerEnterRaceCheckpoint(playerid)
  315. {
  316. return 1;
  317. }
  318.  
  319. public OnPlayerLeaveRaceCheckpoint(playerid)
  320. {
  321. return 1;
  322. }
  323.  
  324. public OnRconCommand(cmd[])
  325. {
  326. return 1;
  327. }
  328.  
  329. public OnPlayerRequestSpawn(playerid)
  330. {
  331. return 1;
  332. }
  333.  
  334. public OnObjectMoved(objectid)
  335. {
  336. return 1;
  337. }
  338.  
  339. public OnPlayerObjectMoved(playerid, objectid)
  340. {
  341. return 1;
  342. }
  343.  
  344. public OnPlayerPickUpPickup(playerid, pickupid)
  345. {
  346. return 1;
  347. }
  348.  
  349. public OnVehicleMod(playerid, vehicleid, componentid)
  350. {
  351. return 1;
  352. }
  353.  
  354. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  355. {
  356. return 1;
  357. }
  358.  
  359. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  360. {
  361. return 1;
  362. }
  363.  
  364. public OnPlayerSelectedMenuRow(playerid, row)
  365. {
  366. return 1;
  367. }
  368.  
  369. public OnPlayerExitedMenu(playerid)
  370. {
  371. return 1;
  372. }
  373.  
  374. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  375. {
  376. return 1;
  377. }
  378.  
  379. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  380. {
  381. if ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
  382. {
  383. return 0;
  384. }
  385.  
  386. return 1;
  387. }
  388.  
  389. public OnRconLoginAttempt(ip[], password[], success)
  390. {
  391. return 1;
  392. }
  393.  
  394. public OnPlayerUpdate(playerid)
  395. {
  396. return 1;
  397. }
  398.  
  399. public OnPlayerStreamIn(playerid, forplayerid)
  400. {
  401. return 1;
  402. }
  403.  
  404. public OnPlayerStreamOut(playerid, forplayerid)
  405. {
  406. return 1;
  407. }
  408.  
  409. public OnVehicleStreamIn(vehicleid, forplayerid)
  410. {
  411. return 1;
  412. }
  413.  
  414. public OnVehicleStreamOut(vehicleid, forplayerid)
  415. {
  416. return 1;
  417. }
  418.  
  419. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  420. {
  421. if(dialogid == dregister) //If dialog id is a register dialog
  422. {//then
  423. if(!response) return Kick(playerid); //If they clicked the second button "Quit", we will kick them.
  424. if(response) //if they clicked the first button "Register"
  425. {//then
  426. if(!strlen(inputtext)) //If they didn't enter any password
  427. {// then we will tell to them to enter the password to register
  428. ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
  429. return 1;
  430. }
  431. //If they have entered a correct password for his/her account...
  432. new hashpass[129]; //Now we will create a new variable to hash his/her password
  433. WP_Hash(hashpass,sizeof(hashpass),inputtext);//We will use whirlpool to hash their inputted text
  434. new INI:file = INI_Open(Path(playerid)); // we will open a new file for them to save their account inside of Scriptfiles/Users folder
  435. INI_SetTag(file,"Player's Data");//We will set a tag inside of user's account called "Player's Data"
  436. INI_WriteString(file,"Password",hashpass);//This will write a hashed password into user's account
  437. INI_WriteInt(file,"AdminLevel",0); //Write an integer inside of user's account called "AdminLevel". We will set his level to 0 after he registered.
  438. INI_WriteInt(file,"VIPLevel",0);//As explained above
  439. INI_WriteInt(file,"Money",0);//Write an integer inside of user's account called "Money". We will set their money to 0 after he registered
  440. INI_WriteInt(file,"Scores",0);//Write an integer inside of user's account called "Scores". We will set their score to 0 after he registered
  441. INI_WriteInt(file,"Kills",0);//As explained above
  442. INI_WriteInt(file,"Deaths",0);//As explained above
  443. INI_Close(file);//Now after we've done saving their data, we now need to close the file
  444. SendClientMessage(playerid,-1,"You have been successfully registered");//Tell to them that they have successfully registered a new account
  445. return 1;
  446. }
  447. }
  448. if(dialogid == dlogin) //If dialog id is a login dialog
  449. {//then
  450. if(!response) return Kick(playerid); //If they clicked the second button "Quit", we will kick them.
  451. if(response) //if they clicked the first button "Register"
  452. {//then
  453. new hashpass[129]; //Will create a new variable to hash his/her password
  454. WP_Hash(hashpass,sizeof(hashpass),inputtext); //Will hash inputted password
  455. if(!strcmp(hashpass,pInfo[playerid][Pass])) //If they have insert their correct password
  456. {//then
  457. INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);//We will load his account's data from user's path
  458. SetPlayerScore(playerid,pInfo[playerid][Scores]);//We will get their score inside of his user's account and we will set it here
  459. GivePlayerMoney(playerid,pInfo[playerid][Money]);//As explained above
  460. SendClientMessage(playerid,-1,"Welcome back! You have successfully logged in");//Tell them that they've successfully logged in
  461. }
  462. else //If they've entered an incorrect password
  463. {//then
  464. ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");//We will tell to them that they've entered an incorrect password
  465. return 1;
  466. }
  467. }
  468. }
  469. return 1;
  470. }
  471.  
  472. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  473. {
  474. return 1;
  475. }
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487. /* ===================================== [ Custom Stocks] =======================================*/
  488. stock Path(playerid)
  489. {
  490. new str[128],name[MAX_PLAYER_NAME];
  491. GetPlayerName(playerid,name,sizeof(name));
  492. format(str,sizeof(str),UserPath,name);
  493. return str;
  494. }
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513. /* ================================= [ Custom Functions] ========================================*/
  514. forward loadaccount_user(playerid, name[], value[]);
  515. public loadaccount_user(playerid, name[], value[])
  516. {
  517. INI_String("Password", pInfo[playerid][Pass],129); /*we will use INI_String to load user's password.
  518. ("Password",.. will load user's password inside of user's path. 'pInfo[playerid][Pass]',...We have defined our user's variable above called, pInfo. Now it's time to use it here to load user's password. '129',... 129 is a length of a hashed user's password. Whirlpool will hash 128 characters + NULL*/
  519. INI_Int("AdminLevel",pInfo[playerid][Adminlevel]);/*We will use INI_Int to load user's admin level. INI_Int stands for INI_Integer. This load an admin level. */
  520. INI_Int("VIPLevel",pInfo[playerid][VIPlevel]);//As explained above
  521. INI_Int("Money",pInfo[playerid][Money]); //As explained above
  522. INI_Int("Scores",pInfo[playerid][Scores]);//As explained above
  523. INI_Int("Kills",pInfo[playerid][Kills]);//As explained above
  524. INI_Int("Deaths",pInfo[playerid][Deaths]);//As explained above
  525. return 1;
  526. }
  527.  
  528.  
  529.  
  530. /* ============================== [ Callbacks for Timers ] =========================================== */
  531.  
  532.  
  533. public spectateend(playerid)
  534. return TogglePlayerSpectating(playerid,0), SpawnPlayer(playerid), TextDrawHideForPlayer(playerid, Textdraw0), TextDrawHideForPlayer(playerid, Textdraw1);
  535.  
  536. public exited(playerid)
  537. return SetPlayerHealth(playerid, 0), SendClientMessage(playerid, COLOR_RED, "<!>You have died since you didnt return into your vehicle!");
  538.  
  539. public RandomWeather()
  540. {
  541. Weather = random(20);
  542. SetWeather(Weather);
  543. }
  544.  
  545. public GivePlayerCheck(playerid)
  546. {
  547. GivePlayerMoney(playerid,100);
  548. SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
  549. SendClientMessage(playerid, COLOR_YELLOW, "[PAYDAY] You have received +100$");
  550. SendClientMessage(playerid, COLOR_YELLOW, "[PAYDAY] You received +1 Pilot Time");
  551.  
  552. return 1;
  553. }
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564. /* ============================================ [ Public Commands ] ===================================*/
  565. CMD:car(playerid, params[])
  566. {
  567. new Float:x, Float:y, Float:z;
  568. GetPlayerPos(playerid, x,y,z);
  569. PutPlayerInVehicle(playerid, CreateVehicle(520, x, y, z, 90.0, 1, 2, -1), 0);
  570. return 1;
  571. }
  572.  
  573. CMD:help(playerid, params[])
  574. {
  575. SendClientMessage(playerid, COLOR_YELLOW, "__________________________________________________________");
  576. SendClientMessage(playerid, COLOR_WHITE, "/b, /pm, /n, /stats");
  577. return 1;
  578. }
  579.  
  580. CMD:stats(playerid, params[])
  581. {
  582. SendClientMessage(playerid, 0xFFFFFFFF, " |-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- |");
  583. new string[128];
  584. new aname[MAX_PLAYER_NAME];
  585. GetPlayerName(playerid, aname,sizeof(aname));
  586. format(string,sizeof(string), "%s These are your stats:", aname);
  587. SendClientMessage(playerid, 0xFFFFFFFF,string);
  588. format(string,sizeof(string), "- Cash: %i", GetPlayerMoney(playerid));
  589. SendClientMessage(playerid, 0xFFFFFFFF, string);
  590. format(string,sizeof(string), "- Kills: %i", pInfo[playerid][Kills]);
  591. SendClientMessage(playerid, 0xFFFFFFFF, string);
  592. format(string,sizeof(string), "- Deaths: %i", pInfo[playerid][Deaths]);
  593. SendClientMessage(playerid, 0xFFFFFFFF, string);
  594. format(string,sizeof(string), "- Admin Level: %i", pInfo[playerid][Adminlevel]);
  595. SendClientMessage(playerid, 0xFFFFFFFF, string);
  596. SendClientMessage(playerid, 0xFFFFFFFF, " |-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- |");
  597. return 1;
  598. }
  599.  
  600. CMD:newb(playerid, params[]) return cmd_n(playerid, params);
  601. CMD:n(playerid, params[])
  602. {
  603. if (isnull(params)) return
  604. SendClientMessage(playerid, COLOR_RED, " Usage: /n <your question>");
  605.  
  606. new szString[128], szName[28];
  607. GetPlayerName(playerid, szName, 28);
  608. format(szString, 128, "{33CCFF}Newbie %s(%d): %s", szName, playerid, params);
  609. SendClientMessageToAll(-1, szString);
  610. return 1;
  611. }
  612.  
  613.  
  614. COMMAND:pm(playerid,params[])
  615. {
  616. new ID;
  617. new PMstring[128];
  618. new string[128];
  619. new Iname[MAX_PLAYER_NAME], Pname[MAX_PLAYER_NAME];
  620.  
  621. if (sscanf(params, "ds[128]", ID, PMstring))
  622. {
  623. SendClientMessage(playerid,COLOR_RED,"Usage: /pm (id) (message)");
  624. return 1;
  625. }
  626.  
  627. GetPlayerName(ID,Iname,sizeof(Iname));
  628. GetPlayerName(playerid,Pname,sizeof(Pname));
  629.  
  630. format(string,128,"PM from %i[%s]: %s",playerid,Pname,PMstring);
  631. SendClientMessage(ID,0xFFD720FF,string);
  632. format(string,128,"PM To %s: %s",Iname,PMstring);
  633. SendClientMessage(playerid,0xFFD720FF,string);
  634. PlayerPlaySound(ID,1085,0.0,0.0,0.0);
  635. return 1;
  636. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement