/duty Bugged - 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: /duty Bugged (
/showthread.php?tid=545555)
/duty Bugged -
AYOUYOU - 09.11.2014
GUys When i Use /duty he said admin onduty But if use /duty to OffDuty ican't OnDuty Again
PHP код:
YCMD:duty(playerid, params[], help)
{
#pragma unused help
#pragma unused params
if(P_Data[playerid][pAdmin] == 3) return SCM(playerid, COLOR_RED, "You aren't an admin!");
new
string[128];
if(P_Data[playerid][pDuty] == 3) {
SetPlayerHealth(playerid,100);
SetPlayerColor(playerid,-1);
format(string,sizeof(string)," {FF0000} %s is now off Duty!",GetName(playerid));
SCMToAll(-1,string); P_Data[playerid][pDuty] = 3;}
else {
format(string,sizeof(string)," {FF0000} %s is now on Duty!",GetName(playerid));
SetPlayerHealth(playerid,99999);
SetPlayerColor(playerid,0xFF000000);
SCMToAll(-1,string); P_Data[playerid][pDuty] = 3;}
return 1;
}
Re : /duty Bugged -
AYOUYOU - 09.11.2014
Help?
Re: /duty Bugged -
mirza1221 - 09.11.2014
Код:
New AdminDuty[MAX_PLAYERS];//Put onplayerspawn AdminDuty[playerid] = 0;
CMD:duty(playerid,params[])
{
//Put check if is player admin
if(AdminDuty[playerid] == 0)
{
SCM(playerid,-1,"You Are On Duty");
AdminDuty[playerid] = 1;
}
else if(AdminDuty[playerid] == 1)
{
SCM(playerid,-1,"You Are Off Duty");
AdminDuty[playerid] = 0;
}
return 1;
}
I Think this shud work
Re: /duty Bugged -
Quickie - 09.11.2014
pawn Код:
YCMD:duty(playerid, params[], help)
{
#pragma unused help
#pragma unused params
if(P_Data[playerid][pAdmin] == 3) return SCM(playerid, COLOR_RED, "You aren't an admin!");
new
string[128];
if(P_Data[playerid][pDuty] == 3) {
SetPlayerHealth(playerid,100);
SetPlayerColor(playerid,-1);
format(string,sizeof(string)," {FF0000} %s is now off Duty!",GetName(playerid));
SCMToAll(-1,string); P_Data[playerid][pDuty] = 2;} // this line is your problem just change the "P_Data[playerid][pDuty]=2" << to your off duty number
else {
format(string,sizeof(string)," {FF0000} %s is now on Duty!",GetName(playerid));
SetPlayerHealth(playerid,99999);
SetPlayerColor(playerid,0xFF000000);
SCMToAll(-1,string); P_Data[playerid][pDuty] = 3;}
return 1;
}
Re: /duty Bugged -
Banana_Ghost - 09.11.2014
pawn Код:
new duty[MAX_PLAYERS];
//somewhere under the includes, etc
public OnPlayerConnect(playerid)
{
duty[playerid] =0;
return 1;
}
public OnPlayerDisconnect(playerid)
{
duty[playerid] =0;
return 1;
}
public OnPlayerDeath(playerid,killerid,reason)
{
duty[playerid] =0;
return 1;
}
public OnPlayerSpawn(playerid)
{
duty[playerid] =0;
return 1;
}
YCMD:duty(playerid, params[], help)
{
#pragma unused help
#pragma unused params
if(P_Data[playerid][pAdmin] == 3) return SCM(playerid, COLOR_RED, "You aren't an admin!");
else
{
if(duty[playerid] == 1)
{
new string[128];
SetPlayerHealth(playerid,100);
SetPlayerColor(playerid,-1);
format(string,sizeof(string)," {FF0000} %s is now off Duty!",GetName(playerid));
SCMToAll(-1,string); P_Data[playerid][pDuty] = 3;}
duty[playerid] =1;
}
else
{
format(string,sizeof(string)," {FF0000} %s is now on Duty!",GetName(playerid));
SetPlayerHealth(playerid,99999);
SetPlayerColor(playerid,0xFF000000);
SCMToAll(-1,string);
P_Data[playerid][pDuty] = 3;
}
}
return 1;
}
A more simpler way of doing things so that nothing really gets crossed up.
Re: /duty Bugged -
dominik523 - 09.11.2014
I have no idea why did you create the same topic, but okay.
http://forum.sa-mp.com/showthread.ph...04#post3249404
Let's answer this one more time.
pawn Код:
YCMD:duty(playerid, params[], help)
{
#pragma unused help
#pragma unused params
if(P_Data[playerid][pAdmin] == 3) return SCM(playerid, COLOR_RED, "You aren't an admin!");
new
string[128];
if(P_Data[playerid][pDuty] == 3) {
SetPlayerHealth(playerid,100);
SetPlayerColor(playerid,-1);
format(string,sizeof(string)," {FF0000} %s is now off Duty!",GetName(playerid));
SCMToAll(-1,string); P_Data[playerid][pDuty] = 1;}
else {
format(string,sizeof(string)," {FF0000} %s is now on Duty!",GetName(playerid));
SetPlayerHealth(playerid,99999);
SetPlayerColor(playerid,0xFF000000);
SCMToAll(-1,string); P_Data[playerid][pDuty] = 3;} // <---- This
return 1;
}