Advertisement
Guest User

DogFight World - Unique Script

a guest
Apr 24th, 2013
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 24.77 KB | None | 0 0
  1. // DogFight World - Fly Like a Fighter
  2.  
  3. ////credits
  4. /*SAMP Team - For SA:MP.
  5. *Y_Less - For Many includes in Server.
  6. *Zeex - For zcmd.
  7. *newbienoob - Login/Register system.
  8. *Avi Raj - for Creating this GM.*/
  9.  
  10. #include <a_samp>
  11. #include <YSI\y_ini>
  12. #include <tColors>
  13. #include <zcmd>
  14. #include <sscanf2>
  15.  
  16. #define register  1
  17. #define login     2
  18. #define dogfights 3
  19. #define acmds     4
  20. #define cmds      5
  21. #define rules     6
  22. #define UserPath "Users/%s.ini"
  23.  
  24. native WP_Hash(buffer[],len,const str[]);
  25.  
  26. enum PlayerInfo
  27. {
  28.     Pass[129],
  29.     Adminlevel,
  30.     VIPlevel,
  31.     Money,
  32.     Scores,
  33.     Kills,
  34.     Deaths,
  35.     DogfightWon
  36. }
  37. new pInfo[MAX_PLAYERS][PlayerInfo];
  38.  
  39. stock Path(playerid)
  40. {
  41.     new str[128],name[MAX_PLAYER_NAME];
  42.     GetPlayerName(playerid,name,sizeof(name));
  43.     format(str,sizeof(str),UserPath,name);
  44.     return str;
  45. }
  46.  
  47. forward loadaccount_user(playerid, name[], value[]);
  48. public loadaccount_user(playerid, name[], value[])
  49. {
  50.     INI_String("Password", pInfo[playerid][Pass],129);
  51.     INI_Int("AdminLevel",pInfo[playerid][Adminlevel]);
  52.     INI_Int("VIPLevel",pInfo[playerid][VIPlevel]);
  53.     INI_Int("Money",pInfo[playerid][Money]);
  54.     INI_Int("Scores",pInfo[playerid][Scores]);
  55.     INI_Int("Kills",pInfo[playerid][Kills]);
  56.     INI_Int("Deaths",pInfo[playerid][Deaths]);
  57.     INI_Int("DogfightWon",pInfo[playerid][DogfightWon]);
  58.     return 1;
  59. }
  60.  
  61. new InRustler[MAX_PLAYERS];
  62. new InHydra[MAX_PLAYERS];
  63. new InHunter[MAX_PLAYERS];
  64. new InSeaSparrow[MAX_PLAYERS];
  65. new Float:Planespawns[][] =
  66. {
  67.     {-1636.8337,-160.9740,14.8600,315.8028},
  68.     {-1645.6366,-152.4947,14.8544,314.1924},
  69.     {-1654.3047,-143.8319,14.8515,314.5324},
  70.     {-1067.6602,407.5844,14.9496,135.3408},
  71.     {-1075.7490,416.1673,14.9512,134.6229},
  72.     {-1084.5680,424.9647,14.9465,135.2840}
  73. };
  74. main()
  75. {
  76.     print("\n----------------------------------");
  77.     print("DogFight World - Fly Like a Fighter");
  78.     print("----------------------------------\n");
  79. }
  80.  
  81. public OnGameModeInit()
  82. {
  83.     SetGameModeText("DogFight World");
  84.     AddPlayerClass(61, -1764.305786, -579.576904, 16.335937, 89.666854, 0, 0, 0, 0, 0, 0);
  85.     AddPlayerClass(101, -1764.305786, -579.576904, 16.335937, 89.666854, 0, 0, 0, 0, 0, 0);
  86.     return 1;
  87. }
  88.  
  89. public OnGameModeExit()
  90. {
  91.     return 1;
  92. }
  93.  
  94. public OnPlayerRequestClass(playerid, classid)
  95. {
  96.     SetPlayerPos(playerid, -1764.305786, -579.576904, 16.335937);
  97.     SetPlayerFacingAngle(playerid, 89.666854);
  98.     SetPlayerCameraLookAt(playerid, -1764.305786, -579.576904, 16.335937);
  99.     SetPlayerCameraPos(playerid, -1764.305786 + (10 * floatsin(-89.666854, degrees)), -579.576904 + (10 * floatcos(-89.666854, degrees)), 16.335937);
  100.     GameTextForPlayer(playerid,"~w~Select Your ~y~Skin", 3000, 6);
  101.     return 1;
  102. }
  103.  
  104. public OnPlayerConnect(playerid)
  105. {
  106.     new name[MAX_PLAYER_NAME];
  107.     GetPlayerName(playerid,name,sizeof(name));
  108.     if(fexist(Path(playerid)))
  109.     {
  110.         INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
  111.         ShowPlayerDialog(playerid,login,DIALOG_STYLE_INPUT,"DogFight World - Login","Welcome back. This account is registered. \nInsert your password to login to your account","Login","Quit");/*A dialog with input style will appear so you can insert your password to login.*/
  112.     }
  113.     else
  114.     {
  115.         ShowPlayerDialog(playerid,register,DIALOG_STYLE_INPUT,"DogFight World - Register","Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
  116.         return 1;
  117.     }
  118.     return 1;
  119. }
  120.  
  121. public OnPlayerDisconnect(playerid, reason)
  122. {
  123.     new INI:file = INI_Open(Path(playerid));
  124.     INI_SetTag(file,"Player's Data");
  125.     INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]);
  126.     INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);
  127.     INI_WriteInt(file,"Money",GetPlayerMoney(playerid));
  128.     INI_WriteInt(file,"Scores",GetPlayerScore(playerid));
  129.     INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);
  130.     INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);
  131.     INI_WriteInt(file,"DogfightWon",pInfo[playerid][DogfightWon]);
  132.     INI_Close(file);
  133.     return 1;
  134. }
  135.  
  136. public OnPlayerSpawn(playerid)
  137. {
  138.     GameTextForPlayer(playerid,"~w~Select Your ~y~Plane", 3000, 6);
  139.     ShowPlayerDialog(playerid, dogfights, DIALOG_STYLE_LIST, "Dogfight World - Select Your DogFight Plane.", "Rustler\nHydra\nHunter\nSea-Sparrow", "Select", "");
  140.     return 1;
  141. }
  142.  
  143. public OnPlayerDeath(playerid, killerid, reason)
  144. {
  145.     pInfo[playerid][Deaths]++;
  146.     SendClientMessage(killerid, COLOR_CYAN,"Boom! Boom!. You are DEAD!");
  147.     GameTextForPlayer(playerid,"~r~DEAD~", 3000, 6);
  148.     InRustler[playerid] = 0;
  149.     InHydra[playerid] = 0;
  150.     InHunter[playerid] = 0;
  151.     InSeaSparrow[playerid] = 0;
  152.     return 1;
  153. }
  154.  
  155. public OnVehicleSpawn(vehicleid)
  156. {
  157.     return 1;
  158. }
  159.  
  160. public OnVehicleDeath(vehicleid, killerid)
  161. {
  162.     pInfo[killerid][Kills]++;
  163.     pInfo[killerid][DogfightWon]++;
  164.     SetPlayerScore(killerid,(GetPlayerScore(killerid))+ 5);
  165.     GivePlayerMoney(killerid, 500);
  166.     SendClientMessage(killerid, COLOR_CYAN,"Boom! You Owned Him!.");
  167.     GameTextForPlayer(killerid,"~b~OWNED!", 3000, 6);
  168.     return 1;
  169. }
  170.  
  171. public OnPlayerText(playerid, text[])
  172. {
  173.     return 1;
  174. }
  175.  
  176. public OnPlayerCommandText(playerid, cmdtext[])
  177. {
  178.     if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  179.     {
  180.         // Do something here
  181.         return 1;
  182.     }
  183.     return 0;
  184. }
  185.  
  186. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  187. {
  188.     new Float:vx, Float:vy, Float:vz, Float:vHealth, string[10];
  189.     GetVehicleHealth(vehicleid, vHealth);
  190.     new Text3D:V3D = Create3DTextLabel(string,COLOR_YELLOW,vx,vy,vz, 50, 0,0);
  191.     Attach3DTextLabelToVehicle(V3D,vehicleid,vx, vy, vz+1.5);
  192.     format(string, sizeof(string), "Heatlh : %.0f", vHealth);
  193.     return 1;
  194. }
  195.  
  196. public OnPlayerExitVehicle(playerid, vehicleid)
  197. {
  198.     if(InRustler[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"You Cannot Leave the Plane when you are in Dogfight");
  199.     if(InHydra[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"You Cannot Leave the Plane when you are in Dogfight");
  200.     if(InHunter[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"You Cannot Leave the Plane when you are in Dogfight");
  201.     if(InSeaSparrow[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"You Cannot Leave the Plane when you are in Dogfight");
  202.     PutPlayerInVehicle(playerid, vehicleid, 0);
  203.     return 1;
  204. }
  205.  
  206. public OnPlayerStateChange(playerid, newstate, oldstate)
  207. {
  208.     return 1;
  209. }
  210.  
  211. public OnPlayerEnterCheckpoint(playerid)
  212. {
  213.     return 1;
  214. }
  215.  
  216. public OnPlayerLeaveCheckpoint(playerid)
  217. {
  218.     return 1;
  219. }
  220.  
  221. public OnPlayerEnterRaceCheckpoint(playerid)
  222. {
  223.     return 1;
  224. }
  225.  
  226. public OnPlayerLeaveRaceCheckpoint(playerid)
  227. {
  228.     return 1;
  229. }
  230.  
  231. public OnRconCommand(cmd[])
  232. {
  233.     return 1;
  234. }
  235.  
  236. public OnPlayerRequestSpawn(playerid)
  237. {
  238.     return 1;
  239. }
  240.  
  241. public OnObjectMoved(objectid)
  242. {
  243.     return 1;
  244. }
  245.  
  246. public OnPlayerObjectMoved(playerid, objectid)
  247. {
  248.     return 1;
  249. }
  250.  
  251. public OnPlayerPickUpPickup(playerid, pickupid)
  252. {
  253.     return 1;
  254. }
  255.  
  256. public OnVehicleMod(playerid, vehicleid, componentid)
  257. {
  258.     return 1;
  259. }
  260.  
  261. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  262. {
  263.     return 1;
  264. }
  265.  
  266. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  267. {
  268.     return 1;
  269. }
  270.  
  271. public OnPlayerSelectedMenuRow(playerid, row)
  272. {
  273.     return 1;
  274. }
  275.  
  276. public OnPlayerExitedMenu(playerid)
  277. {
  278.     return 1;
  279. }
  280.  
  281. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  282. {
  283.     return 1;
  284. }
  285.  
  286. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  287. {
  288.     return 1;
  289. }
  290.  
  291. public OnRconLoginAttempt(ip[], password[], success)
  292. {
  293.     return 1;
  294. }
  295.  
  296. public OnPlayerUpdate(playerid)
  297. {
  298.     return 1;
  299. }
  300.  
  301. public OnPlayerStreamIn(playerid, forplayerid)
  302. {
  303.     return 1;
  304. }
  305.  
  306. public OnPlayerStreamOut(playerid, forplayerid)
  307. {
  308.     return 1;
  309. }
  310.  
  311. public OnVehicleStreamIn(vehicleid, forplayerid)
  312. {
  313.     return 1;
  314. }
  315.  
  316. public OnVehicleStreamOut(vehicleid, forplayerid)
  317. {
  318.     return 1;
  319. }
  320.  
  321. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  322. {
  323.     if(dialogid == register)
  324.     {
  325.         if(!response) return Kick(playerid);
  326.         if(response)
  327.         {
  328.             if(!strlen(inputtext))
  329.             {
  330.                 ShowPlayerDialog(playerid,register,DIALOG_STYLE_INPUT,"DogFight World - Register","Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
  331.                 return 1;
  332.             }
  333.             new hashpass[129];
  334.             WP_Hash(hashpass,sizeof(hashpass),inputtext);
  335.             new INI:file = INI_Open(Path(playerid));
  336.             INI_SetTag(file,"Player's Data");
  337.             INI_WriteString(file,"Password",hashpass);
  338.             INI_WriteInt(file,"AdminLevel",0);
  339.             INI_WriteInt(file,"VIPLevel",0);
  340.             INI_WriteInt(file,"Money",0);
  341.             INI_WriteInt(file,"Scores",0);
  342.             INI_WriteInt(file,"Kills",0);
  343.             INI_WriteInt(file,"Deaths",0);
  344.             INI_WriteInt(file,"DogfightWon",0);
  345.             INI_Close(file);
  346.             SendClientMessage(playerid,COLOR_GREEN,"You have been successfully registered");
  347.             return 1;
  348.         }
  349.     }
  350.     if(dialogid == login)
  351.     {
  352.         if(!response) return Kick(playerid);
  353.         if(response)
  354.         {
  355.             new hashpass[129];
  356.             WP_Hash(hashpass,sizeof(hashpass),inputtext);
  357.             if(!strcmp(hashpass,pInfo[playerid][Pass]))
  358.             {
  359.                 INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
  360.                 SetPlayerScore(playerid,pInfo[playerid][Scores]);
  361.                 GivePlayerMoney(playerid,pInfo[playerid][Money]);
  362.                 SendClientMessage(playerid,COLOR_GREEN,"Welcome back! You have successfully logged in");
  363.             }
  364.             else
  365.             {
  366.                 ShowPlayerDialog(playerid,login,DIALOG_STYLE_INPUT,"DogFight World - Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");
  367.                 return 1;
  368.             }
  369.         }
  370.     }
  371.     if(dialogid == dogfights)
  372.     {
  373.         if(response)
  374.         {
  375.             if(listitem == 0)
  376.             {
  377.                 SetPlayerVirtualWorld(playerid, 0);
  378.                 new rand = random(sizeof(Planespawns));
  379.                 new veh = CreateVehicle(476,Planespawns[rand][0],Planespawns[rand][1],Planespawns[rand][2],Planespawns[rand][3],-1,-1,-1);
  380.                 PutPlayerInVehicle(playerid,veh,0);
  381.                 InRustler[playerid] = 1;
  382.             }
  383.             if(listitem == 1)
  384.             {
  385.                 SetPlayerVirtualWorld(playerid, 0);
  386.                 new rand = random(sizeof(Planespawns));
  387.                 new veh = CreateVehicle(520,Planespawns[rand][0],Planespawns[rand][1],Planespawns[rand][2],Planespawns[rand][3],-1,-1,-1);
  388.                 PutPlayerInVehicle(playerid,veh,0);
  389.                 InHydra[playerid] = 1;
  390.             }
  391.             if(listitem == 2)
  392.             {
  393.                 SetPlayerVirtualWorld(playerid, 0);
  394.                 new rand = random(sizeof(Planespawns));
  395.                 new veh = CreateVehicle(425,Planespawns[rand][0],Planespawns[rand][1],Planespawns[rand][2],Planespawns[rand][3],-1,-1,-1);
  396.                 PutPlayerInVehicle(playerid,veh,0);
  397.                 InHunter[playerid] = 1;
  398.             }
  399.             if(listitem == 3)
  400.             {
  401.                 SetPlayerVirtualWorld(playerid, 0);
  402.                 new rand = random(sizeof(Planespawns));
  403.                 new veh = CreateVehicle(447,Planespawns[rand][0],Planespawns[rand][1],Planespawns[rand][2],Planespawns[rand][3],-1,-1,-1);
  404.                 PutPlayerInVehicle(playerid,veh,0);
  405.                 InSeaSparrow[playerid] = 1;
  406.             }
  407.         }
  408.         return 1;
  409.     }
  410.     return 1;
  411. }
  412.  
  413. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  414. {
  415.     return 1;
  416. }
  417.  
  418. CMD:rules(playerid, params[])
  419. {
  420.     ShowPlayerDialog(playerid, rules, DIALOG_STYLE_MSGBOX, "Server Rules", "- No Cheating\n- No Spamming\n- Respect Admins\n-No Death Matching\n-No use of Any Kind of Hacks\n\nDo you agree to these rules?", "Yes", "No");
  421.     return 1;
  422. }
  423.  
  424. CMD:changeplane(playerid, params[])
  425. {
  426.     ForceClassSelection(playerid);
  427.     SetPlayerHealth(playerid, 0.00);
  428.     SendClientMessage(playerid, COLOR_RED, "You have Forced yourself to Plane Selection Menu.");
  429.     return 1;
  430. }
  431.  
  432. CMD:report(playerid, params[])
  433. {
  434.     new string[128];
  435.     if(!isnull(params))
  436.     {
  437.         SendClientMessage(playerid, COLOR_YELLOW, "Your report was sent to the Admin Teams.");
  438.         format(string, sizeof(string), "Your Report : %s", params); // Proof to the reporter, that the command worked.
  439.         SendClientMessage(playerid, COLOR_YELLOW, string);
  440.         for(new i=0; i<MAX_PLAYERS; i++)
  441.         {
  442.             if(pInfo[playerid][Adminlevel] >= 1)
  443.             {
  444.                 new name[MAX_PLAYER_NAME];
  445.                 GetPlayerName(playerid,name,MAX_PLAYER_NAME);
  446.                 format(string, sizeof(string), "Report from %s[%d]: %s", name, playerid, params);
  447.                 SendClientMessage(i, COLOR_ORANGE, string); // Send's the format to the online Rcon'ly Logged in Admins.
  448.             }
  449.         }
  450.     }
  451.     else
  452.     {
  453.         SendClientMessage(playerid, COLOR_RED, "USAGE: /Report [Text]"); // Show's the player the Usage.
  454.     }
  455.     return 1;
  456. }
  457.  
  458. CMD:admins(playerid,params[])
  459. {
  460.     new Count, string[128],n[MAX_PLAYER_NAME];
  461.     SendClientMessage(playerid, COLOR_RED, "__________|Admins|__________");
  462.     for(new i=0; i < GetMaxPlayers(); i++) if(IsPlayerConnected(i) && pInfo[i][Adminlevel] > 0) {
  463.         GetPlayerName(i,n,sizeof(n));
  464.         switch(pInfo[i][Adminlevel]) {
  465.            case 1: format(string,sizeof(string),"Global Moderator (Level 1) : %s(%d)",n, playerid);
  466.            case 2: format(string,sizeof(string),"Moderator (Level 2) : %s(%d)",n, playerid);
  467.            case 3: format(string,sizeof(string),"Administrator (Level 3) : %s(%d)",n, playerid);
  468.            case 4: format(string,sizeof(string),"Server Owner (Level 4) : %s(%d)",n, playerid);
  469.         }
  470.         SendClientMessage(playerid,COLOR_RED,string);
  471.         Count++;
  472.     }
  473.     if(Count == 0) SendClientMessage(playerid, COLOR_RED, "No Admins Online");
  474.     SendClientMessage(playerid, COLOR_RED, "____________________________");
  475.     return 1;
  476. }
  477.  
  478. CMD:pm(playerid, params[])
  479. {
  480.     new str[256], str2[256], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
  481.     if(sscanf(params, "us", id, str2))
  482.     {
  483.         SendClientMessage(playerid, 0xFF0000FF, "Usage: /pm <id> <message>");
  484.         return 1;
  485.     }
  486.     if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: Player not connected");
  487.     if(playerid == id) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You cannot pm yourself!");
  488.     {
  489.         GetPlayerName(playerid, Name1, sizeof(Name1));
  490.         GetPlayerName(id, Name2, sizeof(Name2));
  491.         format(str, sizeof(str), "PM To %s(ID %d): %s", Name2, id, str2);
  492.         SendClientMessage(playerid, COLOR_LIGHTGREEN, str);
  493.         format(str, sizeof(str), "PM From %s(ID %d): %s", Name1, playerid, str2);
  494.         SendClientMessage(id, COLOR_LIGHTGREEN, str);
  495.     }
  496.     return 1;
  497. }
  498.  
  499.  
  500. CMD:vips(playerid,params[])
  501. {
  502.     new Count, string[128],n[MAX_PLAYER_NAME];
  503.     SendClientMessage(playerid, COLOR_ORANGE, "__________|VIPS|__________");
  504.     for(new i=0; i < GetMaxPlayers(); i++) if(IsPlayerConnected(i) && pInfo[i][VIPlevel] > 0) {
  505.         GetPlayerName(i,n,sizeof(n));
  506.         switch(pInfo[i][VIPlevel]) {
  507.            case 1: format(string,sizeof(string),"VIP : %s(%d)",n, playerid);
  508.         }
  509.         SendClientMessage(playerid,COLOR_ORANGE,string);
  510.         Count++;
  511.     }
  512.     if(Count == 0) SendClientMessage(playerid, COLOR_ORANGE, "No VIPS Online");
  513.     SendClientMessage(playerid, COLOR_ORANGE, "____________________________");
  514.     return 1;
  515. }
  516.  
  517. CMD:cmds(playerid, params[])
  518. {
  519.     ShowPlayerDialog(playerid, cmds, DIALOG_STYLE_MSGBOX, "Server Commands","/rules\n/changeplane\n/report\n/admins\n/vips\n/pm","Close","");
  520.     return 1;
  521. }
  522.  
  523. /////////////////////////////////////////////////////////////////////////////// Admin cmds
  524. CMD:setadmin(playerid, params[])
  525. {
  526.     new levels,Nam[MAX_PLAYER_NAME],pname[MAX_PLAYER_NAME],str[128],ID;
  527.     if(!IsPlayerAdmin(playerid))return 0; //This command only works for rcon
  528.     if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,COLOR_RED, "USAGE: /setadmin [ID] [Level 1-4]");//it will show this if you dont use the format properly
  529.     if(levels > 4) return SendClientMessage(playerid,COLOR_RED,"LEVELS AVAILABLE 1-4!");//Available levels
  530.     if(!IsPlayerConnected(ID))return SendClientMessage(playerid,COLOR_RED,"That user is not connected.");//Detect if the id/partofname is connected
  531.     if(pInfo[ID][Adminlevel] == levels) return SendClientMessage(playerid,0xFF0000FF, "ERROR: That person is already this admin level!");//Detect if the guy is already the level you setted
  532.     GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);//define the playerid name
  533.     GetPlayerName(ID,pname,MAX_PLAYER_NAME);//define the other person name
  534.     if(levels == 0)
  535.     {
  536.         format(str, sizeof(str),"%s has your Admin level to %d on the server. *cry *cry",Nam,levels);
  537.         SendClientMessage(ID,0xFF9900AA,str);
  538.         format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
  539.         SendClientMessage(playerid,0xFF9900AA,str);
  540.         pInfo[ID][Adminlevel] = levels;//this sets the player level
  541.         return 1;
  542.     }
  543.     format(str, sizeof(str),"%s has your Admin level to %d on the server.",Nam,levels);
  544.     SendClientMessage(ID,0xFF9900AA,str);
  545.     format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
  546.     SendClientMessage(playerid,0xFF9900AA,str);
  547.     pInfo[ID][Adminlevel] = levels;
  548.     return 1;
  549. }
  550.  
  551. CMD:setvip(playerid, params[])
  552. {
  553.     new levels,Nam[MAX_PLAYER_NAME],pname[MAX_PLAYER_NAME],str[128],ID;
  554.     if(!IsPlayerAdmin(playerid))return 0; //This command only works for rcon
  555.     if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,COLOR_RED, "USAGE: /setvip [ID] [Level]");//it will show this if you dont use the format properly
  556.     if(levels > 1) return SendClientMessage(playerid,COLOR_RED,"LEVELS AVAILABLE 1!");//Available levels
  557.     if(!IsPlayerConnected(ID))return SendClientMessage(playerid,COLOR_RED,"That user is not connected.");//Detect if the id/partofname is connected
  558.     if(pInfo[ID][VIPlevel] == levels) return SendClientMessage(playerid,0xFF0000FF, "ERROR: That person is already this admin level!");//Detect if the guy is already the level you setted
  559.     GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);//define the playerid name
  560.     GetPlayerName(ID,pname,MAX_PLAYER_NAME);//define the other person name
  561.     if(levels == 0)
  562.     {
  563.         format(str, sizeof(str),"%s has your VIP level to %d on the server. *cry *cry",Nam,levels);
  564.         SendClientMessage(ID,0xFF9900AA,str);
  565.         format(str, sizeof(str),"You had set %s VIP level to %d!",pname,levels);
  566.         SendClientMessage(playerid,0xFF9900AA,str);
  567.         pInfo[ID][VIPlevel] = levels;//this sets the player level
  568.         return 1;
  569.     }
  570.     format(str, sizeof(str),"%s has your VIP level to %d on the server.",Nam,levels);
  571.     SendClientMessage(ID,0xFF9900AA,str);
  572.     format(str, sizeof(str),"You had set %s VIP level to %d!",pname,levels);
  573.     SendClientMessage(playerid,0xFF9900AA,str);
  574.     pInfo[ID][VIPlevel] = levels;
  575.     return 1;
  576. }
  577.  
  578. CMD:kick(playerid, params[])
  579. {
  580.     new id, reason[128];
  581.     if(pInfo[playerid][Adminlevel] < 1)return SendClientMessage(playerid, COLOR_WHITE, "You need to be a admin to use that command!");
  582.     else if(sscanf(params, "us", id, reason))SendClientMessage(playerid, COLOR_WHITE, "Usage: /kick [id/name][reason]");
  583.     else if(id==playerid)SendClientMessage(playerid,COLOR_WHITE,"Error: You can not kick yourself!");
  584.     else if(pInfo[playerid][Adminlevel] >= 1)SendClientMessage(playerid,COLOR_WHITE,"Error: You can not kick another admin!");
  585.     else if (id==INVALID_PLAYER_ID)SendClientMessage(playerid,COLOR_WHITE,"Error: Player is not connected!");
  586.     else {
  587.         new Name[MAX_PLAYER_NAME], KickMessage[128];
  588.         new Name2[MAX_PLAYER_NAME];
  589.         GetPlayerName(playerid, Name, sizeof(Name));
  590.         GetPlayerName(id, Name2, sizeof(Name2));
  591.         format(KickMessage, sizeof(KickMessage), "%s(%d) has kicked player %s(%d). Reason: %s", Name, playerid, Name2, id);
  592.         SendClientMessageToAll(COLOR_WHITE, KickMessage);
  593.         Kick(id);
  594.     }
  595.     return 1;
  596. }
  597.  
  598. CMD:ban(playerid, params[])
  599. {
  600.     new id, reason[128];
  601.     if(pInfo[playerid][Adminlevel] < 1)return SendClientMessage(playerid, COLOR_WHITE, "You need to be a admin to use that command!");
  602.     else if(sscanf(params, "us", id, reason))SendClientMessage(playerid, COLOR_WHITE, "Usage: /ban [id/name][reason]");
  603.     else if(id==playerid)SendClientMessage(playerid,COLOR_WHITE,"Error: You can not Ban yourself!");
  604.     else if(pInfo[playerid][Adminlevel] >= 1)SendClientMessage(playerid,COLOR_WHITE,"Error: You can not ban another admin!");
  605.     else if (id==INVALID_PLAYER_ID)SendClientMessage(playerid,COLOR_WHITE,"Error: Player is not connected!");
  606.     else {
  607.         new Name[MAX_PLAYER_NAME], KickMessage[128];
  608.         new Name2[MAX_PLAYER_NAME];
  609.         GetPlayerName(playerid, Name, sizeof(Name));
  610.         GetPlayerName(id, Name2, sizeof(Name2));
  611.         format(KickMessage, sizeof(KickMessage), "%s(%d) has Banned player %s(%d). Reason: %s", Name, playerid, Name2, id);
  612.         SendClientMessageToAll(COLOR_WHITE, KickMessage);
  613.         Kick(id);
  614.     }
  615.     return 1;
  616. }
  617.  
  618. CMD:askin(playerid, params[])
  619. {
  620.    if(pInfo[playerid][Adminlevel] < 1)return SendClientMessage(playerid, COLOR_WHITE, "You need to be a admin to use that command!");
  621.    {
  622.       SetPlayerSkin(playerid, 219);
  623.    }
  624.    return 1;
  625. }
  626.  
  627. CMD:acmds(playerid, params[])
  628. {
  629.     if(pInfo[playerid][Adminlevel] < 1)return SendClientMessage(playerid, COLOR_WHITE, "You need to be a admin to use that command!");
  630.     {
  631.       ShowPlayerDialog(playerid, acmds, DIALOG_STYLE_MSGBOX, "Admin Commands","/kick\n/ban\n/setadmin\n/setvip\n/askin\n/spec\n/specoff\n/clearchat\n/goto\n/gethere","Close","");
  632.     }
  633.     return 1;
  634. }
  635.  
  636. CMD:ahelp(playerid, params[])
  637. {
  638.     if(pInfo[playerid][Adminlevel] < 1)return SendClientMessage(playerid, COLOR_WHITE, "You need to be a admin to use that command!");
  639.     {
  640.       ShowPlayerDialog(playerid, acmds, DIALOG_STYLE_MSGBOX, "Admin Commands","/kick\n/ban\n/setadmin\n/setvip\n/askin\n/spec\n/specoff\n/clearchat\n/goto\n/gethere","Close","");
  641.     }
  642.     return 1;
  643. }
  644.  
  645. CMD:clearchat(playerid,params[])
  646. {
  647.    if(pInfo[playerid][Adminlevel] < 1 ) return SendClientMessage(playerid, COLOR_RED, "You must be Admin to use this command!" );
  648.    {
  649.      for( new i = 0; i <= 100; i ++ ) SendClientMessageToAll( COLOR_WHITE, "" );
  650.    }
  651.    return 1;
  652. }
  653.  
  654. CMD:goto(playerid, params[])
  655. {
  656.     new ID;//creates a new something idk what we call it :P but it is defined later on or used in something this 1 is used in next line
  657.     if(sscanf(params, "u", ID)) SendClientMessage(playerid, 0xFF0000FF, "USAGE: /goto [id]");//checks if you have written something after /goto if no it sends error
  658.     else if(!IsPlayerConnected(ID) || ID == playerid) return SendClientMessage(playerid, 0xFF0000FF, "This player is offline or it is yourself");//checks if the player you are teleporting to is connected or if it is yourself if yes then comes an error
  659.     else if(pInfo[playerid][Adminlevel] < 1 ) return SendClientMessage(playerid, COLOR_RED, "You must be Admin to use this command!" );
  660.     else//ELSE what will happen if no errors
  661.     {
  662.     new Float:x, Float:y, Float:z;//creates new floats
  663.     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
  664.     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
  665.     }
  666.     return 1;
  667. }
  668.  
  669. CMD:gethere(playerid,params[])
  670. {
  671.     new ID;
  672.     new targetid, Float:x, Float:y, Float:z;//defines floats and [U]targetid(same which we did as id above)[/U]
  673.     if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /gethere [id]");//checks if there is something written after /gethere if no sends the usage error
  674.     if(!IsPlayerConnected(ID) || ID == playerid) return SendClientMessage(playerid, 0xFF0000FF, "This player is offline or it is yourself");//checks if the player is conneted or not and also checks that we are not teleporting ourselves to our self :P if we are it sends error
  675.     else if(pInfo[playerid][Adminlevel] < 1 ) return SendClientMessage(playerid, COLOR_RED, "You must be Admin to use this command!" );
  676.     GetPlayerPos(playerid, x, y, z);//gets player pos PLAYER POS not targetid
  677.     SetPlayerPos(targetid, x+1, y+1, z);//gets the TARGETID player to the PLAYERID x+1,y+1 and z remains same as it defines height
  678.     return 1;
  679. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement