CopDuty problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: CopDuty problem (
/showthread.php?tid=383463)
CopDuty problem -
VladCanarez - 07.10.2012
Well, there's a problem...
I've made it where you need to be a LAPD officer to go on copduty and use cuff etc.
And this sounds very noobish, but for an odd reason, it's not allowing me to do that after I use /setfactionleader
Setfactionleader is fully functional on other factions, just not LAPD.
Here's my code
P.S: I CBA to find it myself, if you could do this for me, i'd be happy lol
pawn Код:
CMD:pduty(playerid, params[])
{
if(PlayerInfo[playerid][pMember] == 1)
{
if(CopDuty[playerid] == 0)
{
new string[128];
format(string, sizeof(string), "%s grabs a badge and a police belt from the locker.", PlayerNameEx(playerid));
ProxDetector(15.0, playerid, string, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA);
GPW(playerid, 24, 250);
GPW(playerid, 3, 1);
GPW(playerid, 41, 400);
GPW(playerid, 25, 200);
SetPlayerColor(playerid, COP_COLOR);
SetPlayerArmour(playerid, 100);
SetPlayerHealth(playerid, 100);
CopDuty[playerid] = 1;
}
else
{
new string[128];
format(string, sizeof(string), "%s puts his badge and police belt back in the locker with his supplies.", PlayerNameEx(playerid));
ProxDetector(15.0, playerid, string, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA);
ResetPlayerWeapons(playerid);
SetPlayerColor(playerid, -1);
CopDuty[playerid] = 0;
}
}
return 1;
}
Re: CopDuty problem -
Chriham3 - 07.10.2012
Should be something like:
pawn Код:
if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1) // checks if is in faction or or is leader of faction 1
{
Can you show me the makeleader command, or what variable leader is?
Re: CopDuty problem -
VladCanarez - 07.10.2012
pawn Код:
CMD:makefactionleader(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 2)
{
new para1,level;
if(!sscanf(params, "ui", para1, level))
{
if(level > 4 || level < 0)
{
SendClientMessage(playerid, COLOR_LIGHTRED, " Don't go below number 0 or above number 4!");
return 1;
}
if(IsPlayerConnected(para1))
{
PlayerInfo[pInfo][pLeader] = -1;
PlayerInfo[pInfo][pMember] = level;
PlayerInfo[pInfo][pRank] = 5;
new string[100];
format(string, sizeof(string), " You have been promoted to leader for %s by Admin %s.", FactionName(level), PlayerNameEx(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), " You have given %s control to run %s.", PlayerNameEx(para1), FactionName(level));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
if(level == 0)
{
SendClientMessage(para1, COLOR_LIGHTBLUE, "* You are now a civilian again.");
PlayerInfo[pInfo][pMember] = 0;
PlayerInfo[pInfo][pLeader] = -1;
PlayerInfo[pInfo][pRank] = 0;
}
UpdatePlayer(para1);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, " Invalid player!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /MakeFactionLeader [playerid/PartOfName] [Faction ID]");
}
}
return 1;
}