Advertisement
Dayrion

aazde

May 15th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 13.59 KB | None | 0 0
  1. //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  2.  
  3.  
  4. CMD:invit(playerid, params[])
  5. {
  6.     new target;
  7.     if(!LawE(playerid)) return SendClientMessage(playerid, -1, "[{82CAFF}Error{FFFFFF}] You are not allowed to use this command");
  8.     if(!duty(playerid)) return SendClientMessage(playerid, -1, "[{82CAFF}Error{FFFFFF}] You need be on duty");
  9.     if(strcmp(GetName(playerid), Factions[U_Stats[playerid][pFaction]][fLeader])) return SendClientMessage(playerid, -1, "[{82CAFF}Error{FFFFFF}] You need to be the leader of the faction");
  10.     if(sscanf(params, "u", target)) return SendClientMessage(playerid, -1, "[{82CAFF}Use{FFFFFF}] /invit [player_id]");
  11.     if(target == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "[{82CAFF}Error{FFFFFF}] This player is not connected");
  12.     if(U_Stats[target][pFaction] == -1) return SendClientMessage(playerid, -1, "[{82CAFF}Error{FFFFFF}] This player is in a faction.");
  13.  
  14.     new INI:File = INI_Open(UserPath(target));
  15.     INI_SetTag(File, "data");
  16.     INI_WriteString(File, "Rank", rankFac[U_Stats[playerid][pFaction]][0][0]);
  17.     INI_WriteInt(File, "Faction", U_Stats[playerid][pFaction]);
  18.     INI_Close(File);
  19.     INI_ParseFile(UserPath(target), "LoadUser_%s", .bExtra = true, .extra = target);
  20.  
  21.     new str[200];
  22.     format(str, sizeof(str), "{82CAFF}ยป %s %s has invited %s in the faction!", U_Stats[playerid][pRank], GetName(playerid), GetName(target));
  23.     FacRadio(playerid, str);
  24.  
  25.     return 1;
  26. }
  27.  
  28.  
  29. //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  30.  
  31. CMD:fire(playerid, params[])
  32. {
  33.     new target;
  34.     if(!LawE(playerid)) return SendClientMessage(playerid, -1, "[{82CAFF}Error{FFFFFF}] You are not allowed to use this command");
  35.     if(!duty(playerid)) return SendClientMessage(playerid, -1, "[{82CAFF}Error{FFFFFF}] You need be on duty");
  36.     if(strcmp(GetName(playerid), Factions[U_Stats[playerid][pFaction]][fLeader]) && U_Stats[playerid][pLevel] < 12) return SendClientMessage(playerid, -1, "[{82CAFF}Error{FFFFFF}] You need to be the leader of the faction");
  37.     if(sscanf(params, "u", target)) return SendClientMessage(playerid, -1, "[{82CAFF}Use{FFFFFF}] /fire [player_id]");
  38.     if(target == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "[{82CAFF}Error{FFFFFF}] This player is not connected");
  39.     if(U_Stats[target][pFaction] == -1 || U_Stats[target][pFaction] != U_Stats[playerid][pFaction]) return SendClientMessage(playerid, -1, "[{82CAFF}Error{FFFFFF}] This player is not in your faction.");
  40.  
  41.     if(!strcmp(Factions[U_Stats[target][pFaction]][fLeader], GetName(playerid)))
  42.     {
  43.         new INI:file = INI_Open(FactionPath(U_Stats[target][pFaction]));
  44.         INI_SetTag(file, "data");
  45.         INI_WriteString(file,"Leader","None");
  46.         INI_Close(file);
  47.         INI_ParseFile(FactionPath(U_Stats[target][pFaction]), "LoadFaction_data", .bExtra = true, .extra = U_Stats[target][pFaction]);
  48.  
  49.         new INI:File = INI_Open(UserPath(target));
  50.         INI_SetTag(File, "data");
  51.         INI_WriteString(File, "Rank", "None");
  52.         INI_WriteInt(File, "Faction", -1);
  53.         INI_Close(File);
  54.         INI_ParseFile(UserPath(target), "LoadUser_%s", .bExtra = true, .extra = target);
  55.         SetPlayerArmour(playerid, 0.0);
  56.         ResetPlayerWeapons(playerid);
  57.     }
  58.     else
  59.     {
  60.         new INI:File = INI_Open(UserPath(target));
  61.         INI_SetTag(File, "data");
  62.         INI_WriteString(File, "Rank", "None");
  63.         INI_WriteInt(File, "Faction", -1);
  64.         INI_Close(File);
  65.         INI_ParseFile(UserPath(target), "LoadUser_%s", .bExtra = true, .extra = target);
  66.  
  67.         SetPlayerArmour(playerid, 0.0);
  68.         ResetPlayerWeapons(playerid);
  69.     }
  70.  
  71.     new str[200];
  72.     format(str, sizeof(str), "{82CAFF}ยป %s %s has fired %s", U_Stats[playerid][pRank], GetName(playerid), GetName(target));
  73.     FacRadio(playerid, str);
  74.  
  75.     return 1;
  76. }
  77. //------------------------------------------------------------------------------------------------
  78. // ==============================================================================================
  79. //                            Los Angeles Fire Department | Commands
  80. // ==============================================================================================
  81. //------------------------------------------------------------------------------------------------
  82. CMD:healthcare(playerid, params[])
  83. {
  84.     if(IsPlayerInRangeOfPoint(playerid, 12.5, 1973.4854, 1167.9103, -5.2087))
  85.     {
  86.         new text[128];
  87.         if(sscanf(params, "s", text))
  88.         {
  89.             if(U_Stats[playerid][pHealthCare] == 0)
  90.             {
  91.                 ProxDetector(15, playerid, "{D1D1D1}Dash Female says: Hi, It seems like you do not have a health care yet! Do you want to purchase it?",-1);
  92.                 SendClientMessage(playerid, -1, "{FFFFFF}[{82CAFF}Info{FFFFFF}] Use /healthcare purchase for $2.500");
  93.             }
  94.             else
  95.             {
  96.                 ProxDetector(15, playerid, "{D1D1D1}Dash Female says: Hi, You already have bought healthcare!",-1);
  97.             }
  98.         }
  99.         else
  100.         {
  101.             new string[128];
  102.             format(string, sizeof(string), "{D1D1D1}%s says: Yes.", GetName(playerid));
  103.             ProxDetector(15, playerid, string, -1);
  104.             if(GetPlayerMoney(playerid) > 2499)
  105.             {
  106.                 U_Stats[playerid][pHealthCare] = 1;
  107.                 ProxDetector(15, playerid, "{D1D1D1}Dash Female says: Thank you for purchasing the health care!",-1);
  108.                 GivePlayerMoney(playerid, -2500);
  109.             }
  110.             else
  111.             {
  112.                 ProxDetector(15, playerid, "{D1D1D1}Dash Female says: Please come back once you have 2500 dollars.",-1);
  113.             }
  114.         }
  115.     }
  116.     return 1;
  117. }
  118. //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  119.  
  120.    
  121. //------------------------------------------------------------------------------------------------
  122. // ==============================================================================================
  123. //                            Los Angeles Police Department | Commands
  124. // ==============================================================================================
  125. //------------------------------------------------------------------------------------------------
  126.  
  127. new IsSuspect[MAX_PLAYERS];
  128. new IsPrisonnier[MAX_PLAYERS];
  129.  
  130. CMD:duty(playerid,params[])
  131. {
  132.     if(!LawE(playerid)) return SendClientMessage(playerid, -1, "[{82CAFF}Error{FFFFFF}] You are not allowed to use this command");
  133.     //if(!IsPlayerInRangeOfPoint(playerid, range, x, y, z)) return SendClientMessage(playerid, -1, "[{82CAFF}Infomation{FFFFFF}] You must be at the comico'");;
  134.     if(IsOnDuty[playerid] == false)
  135.     {
  136.         new str[128];
  137.         IsOnDuty[playerid] = true;
  138.         SendClientMessage(playerid, -1, "[{82CAFF}Infomation{FFFFFF}] You are now on duty");
  139.         format(str, sizeof(str), "* %s take his badge, weapon and radio.", GetName(playerid));
  140.         ProxDetector(15, playerid, str, 0xCC56CCFF);
  141.         SetPlayerArmour(playerid, 100.0);
  142.         GivePlayerWeapon(playerid, WEAPON_DEAGLE, 100);
  143.         GivePlayerWeapon(playerid, WEAPON_NITESTICK, 1);
  144.         GivePlayerWeapon(playerid, WEAPON_SPRAYCAN, 1000);
  145.         return 1;
  146.     }
  147.     else
  148.     {
  149.         new str[128];
  150.         IsOnDuty[playerid] = false;
  151.         SendClientMessage(playerid, -1, "[{82CAFF}Infomation{FFFFFF}] You are no longer on duty");
  152.         format(str, sizeof(str), "* %s put his badge, weapon, radio into his locker.", GetName(playerid));
  153.         ProxDetector(15, playerid, str, 0xCC56CCFF);
  154.         SetPlayerArmour(playerid, 0.0);
  155.         ResetPlayerWeapons(playerid);
  156.         return 1;
  157.     }
  158. }
  159.  
  160.  
  161. //------------------------------------------------------------------------------------------------
  162.  
  163. CMD:m(playerid, params[])
  164. {
  165.     if(!LawE(playerid)) return SendClientMessage(playerid, -1, "[{82CAFF}Error{FFFFFF}] You are not allowed to use this command");
  166.     if(!duty(playerid)) return SendClientMessage(playerid, -1, "[{82CAFF}Error{FFFFFF}] You need be on duty");
  167.     if(U_Stats[playerid][pFaction] != 1 && U_Stats[playerid][pFaction] != 2) return SendClientMessage(playerid, -1, "[{82CAFF}Error{FFFFFF}] You aren't allowed to use this command");
  168.     new text[150];
  169.     if(sscanf(params, "s[149]", text)) return SendClientMessage(playerid, -1, "[{82CAFF}Use{FFFFFF}] /m [Message]");
  170.     format(text, sizeof(text), "{ff0000}((%s | %s)) {FFFFFF}%s", GetName(playerid), Factions[U_Stats[playerid][pFaction]-1][fShortName], text);
  171.     ProxDetector(30, playerid, text, -1);
  172.     return 1;
  173. }
  174.  
  175.  
  176. //------------------------------------------------------------------------------------------------
  177.  
  178. CMD:r(playerid, params[])
  179. {
  180.     new text[150];
  181.     if(sscanf(params, "s[149]", text)) return SendClientMessage(playerid, -1, "[{82CAFF}Use{FFFFFF}] /r [Message]");
  182.     format(text, sizeof(text), "{1E90FF}(Radio) %s %s : %s", U_Stats[playerid][pRank], GetName(playerid), text);
  183.     FacRadio(playerid, text);
  184.     return 1;
  185. }
  186.  
  187. //------------------------------------------------------------------------------------------------
  188.  
  189. CMD:d(playerid, params[])
  190. {
  191.     if(!LawE(playerid)) return SendClientMessage(playerid, -1, "[{82CAFF}Error{FFFFFF}] You are not allowed to use this command");
  192.     if(!duty(playerid)) return SendClientMessage(playerid, -1, "[{82CAFF}Error{FFFFFF}] You need be on duty");
  193.     new text[150];
  194.     if(sscanf(params, "s[149]", text)) return SendClientMessage(playerid, -1, "[{82CAFF}Use{FFFFFF}] /d (regional) [Message]");
  195.     format(text, sizeof(text), "{B4BA00}(%s) %s %s : %s", Factions[U_Stats[playerid][pFaction]-1][fShortName], U_Stats[playerid][pRank], GetName(playerid), text);
  196.     DepRadio(playerid, text);
  197.     return 1;
  198. }
  199.  
  200. //------------------------------------------------------------------------------------------------
  201.  
  202. CMD:su(playerid, params[])
  203. {
  204.     if(!LawE(playerid)) return SendClientMessage(playerid, -1, "[{82CAFF}Error{FFFFFF}] You are not allowed to use this command");
  205.     if(!duty(playerid)) return SendClientMessage(playerid, -1, "[{82CAFF}Error{FFFFFF}] You need be on duty");
  206.     new target, reason[111];
  207.     if(sscanf(params, "is[110]", target, reason)) return SendClientMessage(playerid, -1, "[{82CAFF}Use{FFFFFF}] /su(uspect) [target_id] [reason]");
  208.     new str[120];
  209.     format(str, sizeof(str), "[{82CAFF}SUSPECT{FFFFFF}] %s | %s %s make %s suspect | Reason : %s", Factions[U_Stats[playerid][pFaction]-1][fShortName], U_Stats[playerid][pRank], GetName(playerid), GetName(target), reason);
  210.     IsSuspect[target] = 1;
  211.     DepRadio(playerid, str);
  212.     return 1;
  213. }
  214.  
  215. //------------------------------------------------------------------------------------------------
  216.  
  217. CMD:arrest(playerid, params[])
  218. {
  219.     if(!LawE(playerid)) return SendClientMessage(playerid, -1, "[{82CAFF}Error{FFFFFF}] You are not allowed to use this command");
  220.     if(!duty(playerid)) return SendClientMessage(playerid, -1, "[{82CAFF}Error{FFFFFF}] You need be on duty");
  221.     new Float:x, Float:y, Float:z, target, time, fine;
  222.     if(sscanf(params, "iii", target, time, fine)) return SendClientMessage(playerid, -1, "[{82CAFF}Use{FFFFFF}] /arrest [target_id] [time] [fine]");
  223.     if(target == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "[{82CAFF}Error{FFFFFF}] Wrong player ID");
  224.     if(IsSuspect[target] != 1) return SendClientMessage(playerid, -1, "[{82CAFF}Error{FFFFFF}] This player is not suspect!");
  225.     GetPlayerPos(playerid, x, y, z);
  226.     //if(!IsPlayerInRangeOfPoint(player, 5.0, x, y, z)) return SendClientMessage(playerid, -1, "[{82CAFF}Error{FFFFFF}] You need to be at the prison");
  227.     if(!IsPlayerInRangeOfPoint(target, 5.0, x, y, z)) return SendClientMessage(playerid, -1, "[{82CAFF}Error{FFFFFF}] The suspect need to be near you!");
  228.     time = time * 60 * 1000;
  229.     SetPlayerPos(target, x, y, z);
  230.     SetTimerEx("FreePrisoniers", time, false, "ii", target, time);
  231.     new str[150];
  232.     format(str, sizeof(str), "[{82CAFF}%s{FFFFFF} Policier %s has arrested %s", Factions[U_Stats[playerid][pFaction]-1][fShortName], GetName(playerid), GetName(target));
  233.     SendClientMessageToAll(-1, str);
  234.     //SetPlayerPos(target, x, y, z);
  235.     IsPrisonnier[target] = 1;
  236.     return 1;
  237. }
  238.  
  239.  
  240. forward FreePrisoniers(suspect, playerid, time);
  241. public FreePrisoniers(suspect, playerid, time)
  242. {
  243.     SetPlayerPos(suspect,1544.2457,-1675.5072,13.5580);
  244.     IsSuspect[suspect] = 0;
  245.     IsPrisonnier[suspect] = 0;
  246.     SendClientMessage(suspect, -1, "[{82CAFF}Prison{FFFFFF}]You are now free.");
  247.     new str[150];
  248.     format(str, sizeof(str), "{82CAFF}ยป %s has been released from the prison after %i min(s)", GetName(suspect), time);
  249.     DepRadio(playerid, str);
  250.     return 1;
  251. }
  252.    
  253. //------------------------------------------------------------------------------------------------------------------------------------------------------------
  254.  
  255. stock DepRadio(playerid, string[])
  256. {
  257.     if(!LawE(playerid)) return 1;
  258.     if(IsPrisonnier[playerid] == 1) return 1;
  259.     new text[150];
  260.     foreach(new i : Player)
  261.     {
  262.         if(!LawE(playerid)) continue;
  263.         format(text, sizeof(text), "%s", string);
  264.         SendClientMessage(i, -1, text);
  265.     }
  266.     return 1;
  267. }
  268.  
  269. stock FacRadio(playerid, string[])
  270. {
  271.     if(IsPrisonnier[playerid] == 1) return 1;
  272.     new text[150];
  273.     foreach(new i : Player)
  274.     {
  275.         if(U_Stats[playerid][pFaction] != U_Stats[i][pFaction]) continue;
  276.         format(text, sizeof(text), "%s", string);
  277.         SendClientMessage(i, -1, text);
  278.     }
  279.     return 1;
  280. }
  281.  
  282. new bool:IsOnDuty[MAX_PLAYERS] = false;
  283. stock duty(playerid)
  284. {
  285.     return (IsOnDuty[playerid] ? true : false);
  286. }
  287.  
  288. stock LawE(playerid)
  289. {
  290.     return (U_Stats[playerid][pFaction] == 1 || U_Stats[playerid][pFaction] == 2 ? true : false);
  291. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement