Guest User

Basic Roleplay Gamemode - Y_INI

a guest
Nov 8th, 2014
737
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 24.92 KB | None | 0 0
  1. //Credits to Y_Less, Dracoblue and Kush.
  2.  
  3. #include <a_samp>
  4. #include <sscanf2>
  5. #include <YSI\y_ini>
  6. #include <zcmd>
  7. #include <foreach>
  8.  
  9. #define DIALOG_REGISTER 1
  10. #define DIALOG_LOGIN 2
  11. #define DIALOG_SUCCESS_1 3
  12. #define DIALOG_SUCCESS_2 4
  13. #define DIALOG_STATS 5
  14.  
  15. #define PATH "/users/%s.ini"
  16.  
  17. #define COL_WHITE 0xFFFFFF
  18. #define COL_RED 0xF81414
  19. #define COL_GREEN 0x00FF22
  20. #define COL_LIGHTBLUE 0x2ca1e4
  21. #define COL_PURPLE 0xC2A2DAAA
  22.  
  23. #define MAX_DROP_ITEMS 1000
  24.  
  25. native WP_Hash(buffer[],len,const str[]);
  26.  
  27. enum pInfo
  28. {
  29.     pPass[129],
  30.     pKills,
  31.     pDeaths,
  32.     pGender,
  33.     pMoney,
  34.     pBan,
  35.     pIP[16],
  36.     pVW,
  37.     pInterior,
  38.     pAdmin,
  39.     pSkin,
  40.     Float:pHealth,
  41.     Float:pArmour,
  42.     Float:posX,
  43.     Float:posY,
  44.     Float:posZ,
  45.     Float:posA
  46. };
  47. new PlayerInfo[MAX_PLAYERS][pInfo];
  48.  
  49. forward IsValidName(playerid);
  50. stock IsValidName(playerid)
  51. {
  52.     if (IsPlayerConnected(playerid))
  53.     {
  54.         new player[24];
  55.         GetPlayerName(playerid,player,24);
  56.         for(new n = 0; n < strlen(player); n++)
  57.         {
  58.             if (player[n] == '_' && player[n+1] >= 'A' && player[n+1] <= 'Z') return 1;
  59.             if (player[n] == ']' || player[n] == '[') return 0;
  60.         }
  61.     }
  62.     return 0;
  63. }
  64.  
  65. forward LoadUser_data(playerid,name[],value[]);
  66. public LoadUser_data(playerid,name[],value[])
  67. {
  68.     INI_String("Password", PlayerInfo[playerid][pPass], 129);
  69.     INI_Int("Kills",PlayerInfo[playerid][pKills]);
  70.     INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
  71.     INI_Int("Money", PlayerInfo[playerid][pMoney]);
  72.     INI_Int("Ban",PlayerInfo[playerid][pBan]);
  73.     INI_Int("Admin", PlayerInfo[playerid][pAdmin]);
  74.     INI_Int("IP", PlayerInfo[playerid][pIP]);
  75.     INI_Int("Interior", PlayerInfo[playerid][pInterior]);
  76.     INI_Int("VirutalWorld", PlayerInfo[playerid][pVW]);
  77.     INI_Int("Skin", PlayerInfo[playerid][pSkin]);
  78.     INI_Float("Health", PlayerInfo[playerid][pHealth]);
  79.     INI_Float("Armour", PlayerInfo[playerid][pArmour]);
  80.     INI_Float("PositionX",PlayerInfo[playerid][posX]);
  81.     INI_Float("PositionY",PlayerInfo[playerid][posY]);
  82.     INI_Float("PositionZ",PlayerInfo[playerid][posZ]);
  83.     INI_Float("PositionA",PlayerInfo[playerid][posA]);
  84.     return 1;
  85. }
  86.  
  87. stock SaveUser_data(playerid)
  88. {
  89.     new INI:File = INI_Open(UserPath(playerid));
  90.  
  91.     GetPlayerPos(playerid, PlayerInfo[playerid][posX], PlayerInfo[playerid][posY], PlayerInfo[playerid][posZ]);
  92.     GetPlayerFacingAngle(playerid, PlayerInfo[playerid][posA]);
  93.  
  94.     INI_SetTag(File,"data");
  95.     INI_WriteInt(File,"Skin", GetPlayerSkin(playerid));
  96.     INI_WriteInt(File,"Ban", PlayerInfo[playerid][pBan]);
  97.     INI_WriteInt(File,"Money", GetPlayerMoney(playerid));
  98.     INI_WriteInt(File,"Admin", PlayerInfo[playerid][pAdmin]);
  99.     INI_WriteString(File,"IP", PlayerInfo[playerid][pIP]);
  100.     INI_WriteInt(File,"Interior", GetPlayerInterior(playerid));
  101.     INI_WriteInt(File,"VirtualWorld", GetPlayerVirtualWorld(playerid));
  102.     INI_WriteFloat(File,"Health", GetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]));
  103.     INI_WriteFloat(File,"Armour", GetPlayerArmour(playerid, PlayerInfo[playerid][pArmour]));
  104.     INI_WriteFloat(File,"PositionX", PlayerInfo[playerid][posX]);
  105.     INI_WriteFloat(File,"PositionY", PlayerInfo[playerid][posY]);
  106.     INI_WriteFloat(File,"PositionZ", PlayerInfo[playerid][posZ]);
  107.     INI_WriteFloat(File,"PositionA", PlayerInfo[playerid][posA]);
  108.     INI_Close(File);
  109.     return 1;
  110. }
  111.  
  112. stock UserPath(playerid)
  113. {
  114.     new string[128],playername[MAX_PLAYER_NAME];
  115.     GetPlayerName(playerid,playername,sizeof(playername));
  116.     format(string,sizeof(string),PATH,playername);
  117.     return string;
  118. }
  119.  
  120. stock ProxDetector(Float:radi, playerid, string[],color)
  121. {
  122.     new Float:x,Float:y,Float:z;
  123.     GetPlayerPos(playerid,x,y,z);
  124.     foreach(Player,i)
  125.     {
  126.         if(IsPlayerInRangeOfPoint(i,radi,x,y,z))
  127.         {
  128.             SendClientMessage(i,color,string);
  129.         }
  130.     }
  131. }
  132.  
  133. stock GetName(playerid)
  134. {
  135.     new name[24];
  136.     GetPlayerName(playerid, name, sizeof(name));
  137.     return name;
  138. }
  139.  
  140. stock udb_hash(buf[]) {
  141.     new length=strlen(buf);
  142.     new s1 = 1;
  143.     new s2 = 0;
  144.     new n;
  145.     for (n=0; n<length; n++)
  146.     {
  147.        s1 = (s1 + buf[n]) % 65521;
  148.        s2 = (s2 + s1)     % 65521;
  149.     }
  150.     return (s2 << 16) + s1;
  151. }
  152.  
  153. main()
  154. {
  155.     print("\n----------------------------------");
  156.     print(" Basic Roleplay Gamemode by Sabur Molintino ");
  157.     print("----------------------------------\n");
  158. }
  159.  
  160. public OnGameModeInit()
  161. {
  162.     SetGameModeText("B:R v1.0");
  163.     ShowPlayerMarkers(PLAYER_MARKERS_MODE_OFF);
  164.     SetNameTagDrawDistance(30.0);
  165.     DisableInteriorEnterExits();
  166.     return 1;
  167. }
  168.  
  169. public OnGameModeExit()
  170. {
  171.     return 1;
  172. }
  173.  
  174. public OnPlayerRequestClass(playerid, classid)
  175. {
  176.     return 1;
  177. }
  178.  
  179. public OnPlayerConnect(playerid)
  180. {
  181.     new sdialog[128], rdialog[128];
  182.  
  183.     if(!IsValidName(playerid)) return Kick(playerid);
  184.  
  185.     SetPlayerColor(playerid, -1);
  186.    
  187.     GetPlayerIp(playerid, PlayerInfo[playerid][pIP], 16);
  188.  
  189.     if(fexist(UserPath(playerid)))
  190.     {
  191.         INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  192.         format(sdialog, sizeof(sdialog), "Welcome back, %s\n\n If you wish to login, please enter your password below.", GetName(playerid));
  193.         ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login", sdialog, "Login","Quit");
  194.     }
  195.     else
  196.     {
  197.         format(rdialog, sizeof(rdialog), "Name: %s\n\n Enter your desired password below to register!", GetName(playerid));
  198.         ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register", rdialog ,"Register","Quit");
  199.     }
  200.     return 1;
  201. }
  202.  
  203. public OnPlayerDisconnect(playerid, reason)
  204. {
  205.    SaveUser_data(playerid);
  206.    return 1;
  207. }
  208.  
  209. public OnPlayerSpawn(playerid)
  210. {
  211.     SetPlayerPos(playerid, PlayerInfo[playerid][posX], PlayerInfo[playerid][posY], PlayerInfo[playerid][posZ]);
  212.     SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
  213.     SetPlayerFacingAngle(playerid, PlayerInfo[playerid][posA]);
  214.     SetPlayerInterior(playerid, PlayerInfo[playerid][pInterior]);
  215.     SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVW]);
  216.     SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
  217.     SetPlayerArmour(playerid, PlayerInfo[playerid][pArmour]);
  218.     GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
  219.     return 1;
  220. }
  221.  
  222. public OnPlayerDeath(playerid, killerid, reason)
  223. {
  224.     PlayerInfo[killerid][pKills]++;
  225.     PlayerInfo[playerid][pDeaths]++;
  226.     return 1;
  227. }
  228.  
  229. public OnVehicleSpawn(vehicleid)
  230. {
  231.     return 1;
  232. }
  233.  
  234. public OnVehicleDeath(vehicleid, killerid)
  235. {
  236.     return 1;
  237. }
  238.  
  239. public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
  240. {
  241.     return 1;
  242. }
  243.  
  244. public OnPlayerText(playerid, text[])
  245. {
  246.     new string[128];
  247.  
  248.     format(string, sizeof(string), "%s says: %s", GetName(playerid), text);
  249.     ProxDetector(30.0, playerid, string, -1);
  250.  
  251.     return 0;
  252. }
  253.  
  254. public OnPlayerCommandText(playerid, cmdtext[])
  255. {
  256.     return 0;
  257. }
  258.  
  259. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  260. {
  261.     return 1;
  262. }
  263.  
  264. public OnPlayerExitVehicle(playerid, vehicleid)
  265. {
  266.     return 1;
  267. }
  268.  
  269. public OnPlayerStateChange(playerid, newstate, oldstate)
  270. {
  271.     return 1;
  272. }
  273.  
  274. public OnPlayerEnterCheckpoint(playerid)
  275. {
  276.     return 1;
  277. }
  278.  
  279. public OnPlayerLeaveCheckpoint(playerid)
  280. {
  281.     return 1;
  282. }
  283.  
  284. public OnPlayerEnterRaceCheckpoint(playerid)
  285. {
  286.     return 1;
  287. }
  288.  
  289. public OnPlayerLeaveRaceCheckpoint(playerid)
  290. {
  291.     return 1;
  292. }
  293.  
  294. public OnRconCommand(cmd[])
  295. {
  296.     return 1;
  297. }
  298.  
  299. public OnPlayerRequestSpawn(playerid)
  300. {
  301.     return 1;
  302. }
  303.  
  304. public OnObjectMoved(objectid)
  305. {
  306.     return 1;
  307. }
  308.  
  309. public OnPlayerObjectMoved(playerid, objectid)
  310. {
  311.     return 1;
  312. }
  313.  
  314. public OnPlayerPickUpPickup(playerid, pickupid)
  315. {
  316.     return 1;
  317. }
  318.  
  319. public OnVehicleMod(playerid, vehicleid, componentid)
  320. {
  321.     return 1;
  322. }
  323.  
  324. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  325. {
  326.     return 1;
  327. }
  328.  
  329. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  330. {
  331.     return 1;
  332. }
  333.  
  334. public OnPlayerSelectedMenuRow(playerid, row)
  335. {
  336.     return 1;
  337. }
  338.  
  339. public OnPlayerExitedMenu(playerid)
  340. {
  341.     return 1;
  342. }
  343.  
  344. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  345. {
  346.     return 1;
  347. }
  348.  
  349. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  350. {
  351.     return 1;
  352. }
  353.  
  354. public OnRconLoginAttempt(ip[], password[], success)
  355. {
  356.     return 1;
  357. }
  358.  
  359. public OnPlayerUpdate(playerid)
  360. {
  361.     return 1;
  362. }
  363.  
  364. public OnPlayerStreamIn(playerid, forplayerid)
  365. {
  366.     return 1;
  367. }
  368.  
  369. public OnPlayerStreamOut(playerid, forplayerid)
  370. {
  371.     return 1;
  372. }
  373.  
  374. public OnVehicleStreamIn(vehicleid, forplayerid)
  375. {
  376.     return 1;
  377. }
  378.  
  379. public OnVehicleStreamOut(vehicleid, forplayerid)
  380. {
  381.     return 1;
  382. }
  383.  
  384. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  385. {
  386.     switch( dialogid )
  387.     {
  388.         case DIALOG_REGISTER:
  389.         {
  390.             if (!response) return Kick(playerid);
  391.             if(response)
  392.             {
  393.                 if(!strlen(inputtext))
  394.                 return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register", "You have entered an invalid password.\n\nType your password below to register a new account.","Register","Quit");
  395.  
  396.                 new Hpass[129];
  397.                 WP_Hash(Hpass,sizeof(Hpass), inputtext);
  398.                
  399.                 new INI:File = INI_Open(UserPath(playerid));
  400.                 INI_SetTag(File,"data");
  401.                 INI_WriteString(File,"Password", Hpass);
  402.                 INI_Close(File);
  403.  
  404.                 PlayerInfo[playerid][posX] = 1778.2279;
  405.                 PlayerInfo[playerid][posY] = 1936.1810;
  406.                 PlayerInfo[playerid][posZ] = 13.5469;
  407.                 PlayerInfo[playerid][pVW] = 0;
  408.                 PlayerInfo[playerid][pInterior] = 0;
  409.                 PlayerInfo[playerid][pMoney] = 2500;
  410.                 PlayerInfo[playerid][pHealth] = 100;
  411.                 PlayerInfo[playerid][pSkin] = 299;
  412.                
  413.                 SetSpawnInfo(playerid, 0, 0, 1778.2279, 1936.1810, 13.5469, 0, 0, 0, 0, 0, 0, 0);
  414.                 SpawnPlayer(playerid);
  415.  
  416.                 SendClientMessage(playerid, -1, "Congratulation, you have successfully registered on our server!");
  417.                 SendClientMessage(playerid, -1, "You have been given 2500$ to start in the city!");
  418.                 SendClientMessage(playerid, -1, "Use /help for more information!");
  419.             }
  420.         }
  421.  
  422.         case DIALOG_LOGIN:
  423.         {
  424.             new
  425.             String[100];
  426.            
  427.             if(!response) return Kick(playerid);
  428.             if(response)
  429.             {
  430.                 new Hpass[129];
  431.                 WP_Hash(Hpass,sizeof(Hpass),inputtext);
  432.                 if(!strcmp(Hpass, PlayerInfo[playerid][pPass], false))
  433.                 {
  434.                 if(PlayerInfo[playerid][pBan] == 1)
  435.                 {
  436.                 Kick(playerid);
  437.                 }
  438.                 INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  439.                 SetSpawnInfo(playerid, 0, 0, PlayerInfo[playerid][posX], PlayerInfo[playerid][posY], PlayerInfo[playerid][posZ], PlayerInfo[playerid][posA], 0, 0, 0, 0, 0, 0);
  440.                 SpawnPlayer(playerid);
  441.                 SendClientMessage(playerid, -1, "You have successfully logged in.");
  442.                 }
  443.                 else
  444.                 {
  445.                 format(String, sizeof(String), "Welcome back, %s. \n\nYou have entered an incorrect password.\n\nType your password below to login.", GetName(playerid));
  446.                 ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login", String,"Login","Quit");
  447.                 }
  448.                 return 1;
  449.             }
  450.         }
  451.     }
  452.     return 1;
  453. }
  454.  
  455. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  456. {
  457.     return 1;
  458. }
  459.  
  460. CMD:help(playerid, params[])
  461. {
  462.     SendClientMessage(playerid, -1, "**GENERAL** /me /do /b /s(hout) /stats");
  463.     return 1;
  464. }
  465.  
  466. CMD:ah(playerid, params[]) return cmd_ahelp(playerid, params);
  467. CMD:ahelp(playerid, params[])
  468. {
  469.     SendClientMessage(playerid, -1, "**Level 1** /a(dmin) /kick /sendtols /sendtolv /sendtosf /slap");
  470.     SendClientMessage(playerid, -1, "**LEVEL 2** /freeze /unfreeze /ban /setskin /x /y /z");
  471.     SendClientMessage(playerid, -1, "**LEVEL 3** /unban /givegun /givecash /setarmor /sethealth");
  472.     SendClientMessage(playerid, -1, "**LEVEL 4** /makeadmin /gmx");
  473.    
  474.     return 1;
  475. }
  476.  
  477. CMD:me(playerid, params[])
  478. {
  479.     new string[128], action[100];
  480.  
  481.     if(sscanf(params, "s[100]", action))
  482.     return SendClientMessage(playerid, -1, "USAGE: /me [action]");
  483.  
  484.     format(string, sizeof(string), "* %s %s", GetName(playerid), action);
  485.     ProxDetector(30.0, playerid, string, COL_PURPLE);
  486.  
  487.     return 1;
  488. }
  489.  
  490. CMD:do(playerid, params[])
  491. {
  492.     new string[128], action[100];
  493.  
  494.     if(sscanf(params, "s[100]", action))
  495.     return SendClientMessage(playerid, -1, "USAGE: /do [action]");
  496.  
  497.     format(string, sizeof(string), "%s (( %s ))", action, GetName(playerid));
  498.     ProxDetector(30.0, playerid, string, COL_PURPLE);
  499.  
  500.     return 1;
  501. }
  502.  
  503. CMD:b(playerid, params[])
  504. {
  505.     new string[128];
  506.     if(sscanf(params, "s[100]", string))
  507.     return SendClientMessage(playerid, -1, "USAGE: /b [message]");
  508.  
  509.     format(string, sizeof(string), "(( %s: %s ))", GetName(playerid), string);
  510.     ProxDetector(30.0, playerid, string, -1);
  511.  
  512.     return 1;
  513. }
  514.  
  515.  
  516. CMD:s(playerid, params[]) return cmd_shout(playerid, params);
  517. CMD:shout(playerid, params[])
  518. {
  519.     new string[128], shout[100];
  520.  
  521.     if(sscanf(params, "s[100]", shout))
  522.     return SendClientMessage(playerid, -1, "USAGE: s(hout) [message]");
  523.  
  524.     format(string, sizeof(string), "%s shouts: %s!", GetName(playerid), shout);
  525.     ProxDetector(50.0, playerid, string, -1);
  526.  
  527.     return 1;
  528. }
  529.  
  530. CMD:stats(playerid, params[])
  531. {
  532.     new
  533.     String[500],
  534.     Float: X,
  535.     Float: Y,
  536.     Float: Z;
  537.  
  538.     GetPlayerPos(playerid, X, Y, Z);
  539.  
  540.     format(String, sizeof(String), "Name: %s\n\nKills: %d \n\nDeaths: %d \n\nSkin: %d \n\nX: %f \n\nY: %f \n\n Z: %f", GetName(playerid), PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][pSkin], X, Y, Z);
  541.  
  542.     ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, "User Stats", String, "Close", "");
  543.  
  544.     return 1;
  545. }
  546.  
  547. CMD:kick(playerid, params[])
  548. {
  549.     new
  550.     Id,
  551.     TargetName[MAX_PLAYERS],
  552.     Reason[100],
  553.     String[128];
  554.    
  555.     GetPlayerName(Id, TargetName, sizeof(TargetName));
  556.    
  557.     if(!PlayerInfo[playerid][pAdmin])
  558.     return SendClientMessage(playerid, -1, "You are not authorized to use this command.");
  559.    
  560.     if(PlayerInfo[playerid][pAdmin] > PlayerInfo[playerid][pAdmin])
  561.     return SendClientMessage(playerid, -1, "You can not kick a higher level admin.");
  562.    
  563.     if(!IsPlayerConnected(Id))
  564.     return SendClientMessage(playerid, -1, "The specified player is not online.");
  565.    
  566.     if(sscanf(params, "dd[100]", Id, Reason))
  567.     return SendClientMessage(playerid, -1, "USAGE: /kick [id/partofname] [reason]");
  568.    
  569.     format(String, sizeof(String), "%s has been kicked by %s - Reason: %s.", TargetName, GetName(playerid), Reason);
  570.     SendClientMessageToAll(COL_RED, String);
  571.    
  572.     return 1;
  573. }
  574.  
  575. CMD:ban(playerid, params[])
  576. {
  577.     new
  578.     Id,
  579.     TargetName[MAX_PLAYERS],
  580.     Reason[100],
  581.     String[100];
  582.    
  583.     GetPlayerName(Id, TargetName, sizeof(TargetName));
  584.    
  585.     if(!PlayerInfo[playerid][pAdmin])
  586.     return SendClientMessage(playerid, -1, "You are not authrozied to use this command.");
  587.    
  588.     if(PlayerInfo[playerid][pAdmin] > PlayerInfo[playerid][pAdmin])
  589.     return SendClientMessage(playerid, -1, "You can not ban a higher level admin.");
  590.    
  591.     if(!IsPlayerConnected(Id))
  592.     return SendClientMessage(playerid, -1, "The specified player is not online.");
  593.    
  594.     if(sscanf(params, "dd[100]", Id, Reason))
  595.     return SendClientMessage(playerid, -1, "USAGE; /ban [id/partofname] [reason]");
  596.    
  597.     format(String, sizeof(String), "%s has been banned by %s - Reason: %s.", TargetName, GetName(playerid), Reason);
  598.     SendClientMessageToAll(COL_RED, String);
  599.    
  600.     return 1;
  601. }
  602.  
  603. CMD:unban(playerid,params[])
  604. {
  605.     new
  606.     String[100],
  607.     Name[MAX_PLAYER_NAME];
  608.    
  609.     if(PlayerInfo[playerid][pAdmin] < 3)
  610.     return SendClientMessage(playerid, -1, "You are not authorized to use this command.");
  611.    
  612.     if(sscanf(params,"s[MAX_PLAYER_NAME]",Name))
  613.     return SendClientMessage(playerid, -1, "USAGE: /unban [Exact User Name - FirstName_LastName]");
  614.    
  615.     if(!fexist(String))
  616.     return SendClientMessage(playerid, -1, "Invalid Name Specified.");
  617.  
  618.     format(String, sizeof(String), "/users/%s.ini", Name);
  619.     new INI:File = INI_Open(String);
  620.     INI_SetTag(File, "data");
  621.     INI_WriteInt(File, "Ban", 0);
  622.     INI_Close(File);
  623.  
  624.     format(String, sizeof(String),"Account Unbanned: %s", Name);
  625.     SendClientMessage(playerid, -1, String);
  626.    
  627.     return 1;
  628. }
  629.  
  630. CMD:sendtols(playerid, params[])
  631. {
  632.     new
  633.     Id;
  634.    
  635.     if(!PlayerInfo[playerid][pAdmin])
  636.     return SendClientMessage(playerid, -1, "You are not an administrator");
  637.    
  638.     if(!IsPlayerConnected(Id))
  639.     return SendClientMessage(playerid, -1, "The specified player is not online.");
  640.    
  641.     if(sscanf(params, "d", Id))
  642.     return SendClientMessage(playerid, -1, "USAGE: /sendtols [id/partofname]");
  643.    
  644.     SetPlayerInterior(Id, 0);
  645.     SetPlayerVirtualWorld(Id, 0);
  646.     SetPlayerPos(Id, 1529.6, -1691.2, 13.3);
  647.    
  648.     SendClientMessage(Id, -1, "You have been teleported to Los Santos.");
  649.    
  650.     return 1;
  651. }
  652.  
  653. CMD:sendtosf(playerid, params[])
  654. {
  655.     new
  656.     Id;
  657.  
  658.     if(!PlayerInfo[playerid][pAdmin])
  659.     return SendClientMessage(playerid, -1, "You are not an administrator");
  660.  
  661.     if(!IsPlayerConnected(Id))
  662.     return SendClientMessage(playerid, -1, "The specified player is not online.");
  663.  
  664.     if(sscanf(params, "d", Id))
  665.     return SendClientMessage(playerid, -1, "USAGE: /sendtosf [id/partofname]");
  666.  
  667.     SetPlayerInterior(Id, 0);
  668.     SetPlayerVirtualWorld(Id, 0);
  669.     SetPlayerPos(playerid, -1417.0, -295.8, 14.1);
  670.  
  671.     SendClientMessage(Id, -1, "You have been teleported to San Fierro.");
  672.  
  673.     return 1;
  674. }
  675.  
  676. CMD:sendtolv(playerid, params[])
  677. {
  678.     new
  679.     Id;
  680.  
  681.     if(!PlayerInfo[playerid][pAdmin])
  682.     return SendClientMessage(playerid, -1, "You are not authorized to use this command.");
  683.  
  684.     if(!IsPlayerConnected(Id))
  685.     return SendClientMessage(playerid, -1, "The specified player is not online.");
  686.  
  687.     if(sscanf(params, "d", Id))
  688.     return SendClientMessage(playerid, -1, "USAGE: /sendtolv [id/partofname]");
  689.  
  690.     SetPlayerInterior(Id, 0);
  691.     SetPlayerVirtualWorld(Id, 0);
  692.     SetPlayerPos(playerid, 1698.3444, 1448.6589, 10.7751);
  693.  
  694.     SendClientMessage(Id, -1, "You have been teleported to Las Venturas.");
  695.  
  696.     return 1;
  697. }
  698.  
  699. CMD:x(playerid, params[])
  700. {
  701.     if(PlayerInfo[playerid][pAdmin] < 2)
  702.     return SendClientMessage(playerid, -1, "You are not authorized to use this command.");
  703.    
  704.     GetPlayerPos(playerid, PlayerInfo[playerid][posX], PlayerInfo[playerid][posY], PlayerInfo[playerid][posZ]);
  705.  
  706.     SetPlayerPos(playerid, PlayerInfo[playerid][posX] + 5.0, PlayerInfo[playerid][posY], PlayerInfo[playerid][posZ]);
  707.    
  708.     return 1;
  709. }
  710.  
  711. CMD:y(playerid, params[])
  712. {
  713.     if(PlayerInfo[playerid][pAdmin] < 2)
  714.     return SendClientMessage(playerid, -1, "You are not authorized to use this command.");
  715.    
  716.     GetPlayerPos(playerid, PlayerInfo[playerid][posX], PlayerInfo[playerid][posY], PlayerInfo[playerid][posZ]);
  717.  
  718.     SetPlayerPos(playerid, PlayerInfo[playerid][posX], PlayerInfo[playerid][posY] + 5.0, PlayerInfo[playerid][posZ]);
  719.  
  720.     return 1;
  721. }
  722.  
  723. CMD:z(playerid, params[])
  724. {
  725.     if(PlayerInfo[playerid][pAdmin] < 2)
  726.     return SendClientMessage(playerid, -1, "You are not authorized to use this command.");
  727.    
  728.     GetPlayerPos(playerid, PlayerInfo[playerid][posX], PlayerInfo[playerid][posY], PlayerInfo[playerid][posZ]);
  729.  
  730.     SetPlayerPos(playerid, PlayerInfo[playerid][posX], PlayerInfo[playerid][posY], PlayerInfo[playerid][posZ] + 5.0);
  731.  
  732.     return 1;
  733. }
  734.  
  735. CMD:setskin(playerid, params[])
  736. {
  737.     new
  738.     Id,
  739.     Skin,
  740.     String[100],
  741.     TargetName[MAX_PLAYERS];
  742.    
  743.     GetPlayerName(Id, TargetName, sizeof(TargetName));
  744.    
  745.     if(PlayerInfo[playerid][pAdmin] < 2)
  746.     return SendClientMessage(playerid, -1, "You are not authorized to use this command.");
  747.    
  748.     if(!IsPlayerConnected(Id))
  749.     return SendClientMessage(playerid, -1, "The specified player is not online.");
  750.    
  751.     if(sscanf(params, "dd", Id, Skin))
  752.     return SendClientMessage(playerid, -1, "USAGE: /setskin [id/partofname] [skin]");
  753.    
  754.     SetPlayerSkin(Id, Skin);
  755.    
  756.     format(String, sizeof(String), "You have set %s skin ID to %s.", TargetName, Skin);
  757.     SendClientMessage(playerid, -1, String);
  758.    
  759.     return 1;
  760. }
  761.  
  762. CMD:freeze(playerid, params[])
  763. {
  764.     new
  765.     Id,
  766.     String[100],
  767.     TargetName[MAX_PLAYERS];
  768.    
  769.     GetPlayerName(Id, TargetName, sizeof(TargetName));
  770.    
  771.     if(PlayerInfo[playerid][pAdmin] < 2)
  772.     return SendClientMessage(playerid, -1, "You are not authorized to use this command.");
  773.  
  774.     if(!IsPlayerConnected(Id))
  775.     return SendClientMessage(playerid, -1, "The specified player is not online.");
  776.  
  777.     if(sscanf(params, "d", Id))
  778.     return SendClientMessage(playerid, -1, "USAGE: /freeze [id/partofname]");
  779.    
  780.     TogglePlayerControllable(Id, 1);
  781.    
  782.     format(String, sizeof(String), "You have freezed %s.", TargetName);
  783.     SendClientMessage(playerid, -1, String);
  784.    
  785.     return 1;
  786. }
  787.  
  788. CMD:unfreeze(playerid, params[])
  789. {
  790.     new
  791.     Id,
  792.     String[100],
  793.     TargetName[MAX_PLAYERS];
  794.  
  795.     GetPlayerName(Id, TargetName, sizeof(TargetName));
  796.  
  797.     if(PlayerInfo[playerid][pAdmin] < 2)
  798.     return SendClientMessage(playerid, -1, "You are not authorized to use this command.");
  799.  
  800.     if(!IsPlayerConnected(Id))
  801.     return SendClientMessage(playerid, -1, "The specified player is not online.");
  802.  
  803.     if(sscanf(params, "d", Id))
  804.     return SendClientMessage(playerid, -1, "USAGE: /unfreeze [id/partofname]");
  805.  
  806.     TogglePlayerControllable(Id, 0);
  807.  
  808.     format(String, sizeof(String), "You have unfreezed %s.", TargetName);
  809.     SendClientMessage(playerid, -1, String);
  810.  
  811.     return 1;
  812. }
  813.  
  814. CMD:revokeadmin(playerid, params[])
  815. {
  816.     new
  817.     Id,
  818.     TargetName[MAX_PLAYERS],
  819.     String[100];
  820.    
  821.     GetPlayerName(Id, TargetName, sizeof(TargetName));
  822.    
  823.     if(PlayerInfo[playerid][pAdmin] < 3)
  824.     return SendClientMessage(playerid, -1, "You are not authorized to use this command.");
  825.    
  826.     if(!IsPlayerConnected(Id))
  827.     return SendClientMessage(playerid, -1, "The specified player is not online.");
  828.    
  829.     if(sscanf(params, "d", Id))
  830.     return SendClientMessage(playerid, -1, "USAGE: /revokeadmin [id/partofname]");
  831.    
  832.     PlayerInfo[Id][pAdmin] = 0;
  833.    
  834.     format(String, sizeof(String), "You have revoked %s admin status.", TargetName);
  835.     SendClientMessage(playerid, -1, String);
  836.    
  837.     return 1;
  838. }
  839.  
  840. CMD:makeadmin(playerid, params[])
  841. {
  842.     new
  843.     Id,
  844.     Level,
  845.     TargetName[MAX_PLAYERS],
  846.     String[100];
  847.    
  848.     if(PlayerInfo[playerid][pAdmin] < 4)
  849.     return SendClientMessage(playerid, -1, "You are not authorized to use this command.");
  850.    
  851.     if(!IsPlayerConnected(Id))
  852.     return SendClientMessage(playerid, -1, "The specified player is not online.");
  853.    
  854.     if(sscanf(params, "dd", Id, Level))
  855.     return SendClientMessage(playerid, -1, "USAGE: /makeadmin [id/partofname] [1-6]");
  856.    
  857.     if(1 < Level > 6)
  858.     return SendClientMessage(playerid, -1, "The valid levels are only from 1 - 6.");
  859.    
  860.     PlayerInfo[Id][pAdmin] = Level;
  861.    
  862.     format(String, sizeof(String), "You have made %s admin level to %s.", TargetName, Level);
  863.     SendClientMessage(playerid, -1, String);
  864.    
  865.     return 1;
  866. }
  867.  
  868. CMD:givegun(playerid, params[])
  869. {
  870.     new
  871.     Id,
  872.     Gun,
  873.     Ammo,
  874.     TargetName[MAX_PLAYERS],
  875.     String[100];
  876.    
  877.     GetPlayerName(Id, TargetName, sizeof(TargetName));
  878.    
  879.     if(PlayerInfo[playerid][pAdmin] < 3)
  880.     return SendClientMessage(playerid, -1, "You are not authorized to use this command.");
  881.    
  882.     if(!IsPlayerConnected(Id))
  883.     return SendClientMessage(playerid, -1, "The specifed player is not online.");
  884.    
  885.     if(sscanf(params, "ddd", Id, Gun, Ammo))
  886.     return SendClientMessage(playerid, -1, "USAGE: /givegun [id/partofname] [weaponid] [ammo]");
  887.    
  888.     GivePlayerWeapon(Id, Gun, Ammo);
  889.    
  890.     format(String, sizeof(String), "You have given %s ID Weapon- %s with Ammo %s.", TargetName, Gun, Ammo);
  891.     SendClientMessage(playerid, -1, String);
  892.    
  893.     return 1;
  894. }
  895.  
  896. CMD:gmx(playerid, params[])
  897. {
  898.     if(PlayerInfo[playerid][pAdmin] < 4)
  899.     return SendClientMessage(playerid, -1, "You are not authorized to use this command.");
  900.  
  901.     SendRconCommand("gmx");
  902.  
  903.     return 1;
  904. }
  905.  
  906. CMD:givecash(playerid, params[])
  907. {
  908.     new
  909.     Id,
  910.     Cash;
  911.    
  912.     if(PlayerInfo[playerid][pAdmin] < 3)
  913.     return SendClientMessage(playerid, -1, "You are not authorized to use this command.");
  914.    
  915.     if(!IsPlayerConnected(Id))
  916.     return SendClientMessage(playerid, -1, "The specified ID is invalid.");
  917.    
  918.     if(sscanf(params, "dd", Id, Cash))
  919.     return SendClientMessage(playerid, -1, "USAGE: /givecash [ID] [Cash]");
  920.    
  921.     GivePlayerMoney(Id, Cash);
  922.    
  923.     return 1;
  924. }
  925.  
  926. CMD:sethealth(playerid, params[])
  927. {
  928.     new
  929.     Id,
  930.     Health;
  931.    
  932.     if(PlayerInfo[playerid][pAdmin] < 3)
  933.     return SendClientMessage(playerid, -1, "You are not authorized to use this command.");
  934.    
  935.     if(!IsPlayerConnected(Id))
  936.     return SendClientMessage(playerid, -1, "The specified ID is invalid.");
  937.    
  938.     if(sscanf(params, "df", Id, Health))
  939.     return SendClientMessage(playerid, -1, "USAGE: /sethealth [ID] [Health]");
  940.    
  941.     SetPlayerHealth(Id, Health);
  942.    
  943.     return 1;
  944. }
  945.  
  946. CMD:setarmour(playerid, params[])
  947. {
  948.     new
  949.     Id,
  950.     Armour;
  951.  
  952.     if(PlayerInfo[playerid][pAdmin] < 3)
  953.     return SendClientMessage(playerid, -1, "You are not authorized to use this command.");
  954.  
  955.     if(!IsPlayerConnected(Id))
  956.     return SendClientMessage(playerid, -1, "The specified ID is invalid.");
  957.  
  958.     if(sscanf(params, "df", Id, Armour))
  959.     return SendClientMessage(playerid, -1, "USAGE: /sethealth [ID] [Health]");
  960.  
  961.     SetPlayerArmour(Id, Armour);
  962.  
  963.     return 1;
  964.  
  965. }
Advertisement
Add Comment
Please, Sign In to add comment