Advertisement
Guest User

Basic Roleplay Gamemode - Y_INI

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