SA-MP Forums Archive
/duty is bugged. need help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /duty is bugged. need help (/showthread.php?tid=141456)



/duty is bugged. need help - NiiRV4N4 - 13.04.2010

pawn Код:
if(strcmp(cmd, "/Sduty", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
            if(PlayerInfo[playerid][pFaction] == 8)
            {
                if PlayerToPoint( 5.0, playerid, 326.48, 307.37, 999.15 )
                {
                        if(CopOnDuty[playerid] == 0)
                    {
                      if(PlayerInfo[playerid][pSex] == 1)
                      {
                                PlayerActionMessage(playerid,15.0,"clocks in as a Sheriff, and takes his equipment from the locker");
                            }
                            else
                            {
                              PlayerActionMessage(playerid,15.0,"clocks in as a Sheriff, and takes her equipment from the locker");
                            }
                            SafeGivePlayerWeapon(playerid, 3, 0);
                            SafeGivePlayerWeapon(playerid, 24, 70);
                            SafeGivePlayerWeapon(playerid, 41, 700);
                            CopOnDuty[playerid] = 1;
                            SetPlayerToFactionSkin(playerid);
                            SetPlayerToFactionColor(playerid);

                            format(string, sizeof(string), "[Sheriff:] %s is now an on duty as a Sheriff",GetPlayerNameEx(playerid));
                        SendFactionTypeMessage(1, COLOR_LSPD, string);
                            SafeGivePlayerWeapon(playerid, 3, 0);
                            SafeGivePlayerWeapon(playerid, 24, 70);
                            SafeGivePlayerWeapon(playerid, 41, 700);
                            return 1;
                        }
                        else
                        {
                        if(PlayerInfo[playerid][pSex] == 1)
                      {
                                PlayerActionMessage(playerid,15.0,"clocks out as a Sheriff, and puts his equipment in the locker");
                            }
                            else
                            {
                              PlayerActionMessage(playerid,15.0,"clocks out as a Sheriff, and puts her equipment in the locker");
                            }
                            CopOnDuty[playerid] = 0;
                            SetPlayerToFactionSkin(playerid);
                            SafeResetPlayerWeapons(playerid);
                            return 1;
                        }
                }


            else
                {
                    SendClientMessage(playerid, COLOR_GREY, "[Error:] You are not at the duty position");
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "[Error:] Invalid faction");
                return 1;
            }
        }
        return 1;
    }
if PlayerToPoint( 5.0, playerid, 326.48, 307.37, 999.15 )
{ <-----------THIS IS THE BUG

Код:
error 001: expected token: "*then", but found "{"



Re: /duty is bugged. need help - Steven82 - 14.04.2010

i think you want this instead


Код:
 if(IsPlayerInRangeOfPoint(playerid,range,Float: X,Float:Y,Float: Z);



Re: /duty is bugged. need help - KevKo95 - 14.04.2010

No, this would be correct.

pawn Код:
if(PlayerToPoint(5.0, playerid, 326.48, 307.37, 999.15))



Re: /duty is bugged. need help - Steven82 - 14.04.2010

Код:
PlayerToPoint,
can mean he directing to room, i bet if he use the code i just gave him off the

http://wiki.sa-mp.com

it would work, usually playertopoint is used for switching interior's.


EDIT:

Код:
if(strcmp(cmd, "/Sduty", true) == 0)
{
  if(IsPlayerConnected(playerid))
  {
if(PlayerInfo[playerid][pFaction] == 8)
{
if PlayerToPoint( 5.0, playerid, 326.48, 307.37, 999.15 )
{
if(CopOnDuty[playerid] == 0)
    {
      if(PlayerInfo[playerid][pSex] == 1)
      {
PlayerActionMessage(playerid,15.0,"clocks in as a Sheriff, and takes his equipment from the locker");
}
else
{
  PlayerActionMessage(playerid,15.0,"clocks in as a Sheriff, and takes her equipment from the locker");
}
SafeGivePlayerWeapon(playerid, 3, 0);
SafeGivePlayerWeapon(playerid, 24, 70);
SafeGivePlayerWeapon(playerid, 41, 700);
CopOnDuty[playerid] = 1;
SetPlayerToFactionSkin(playerid);
SetPlayerToFactionColor(playerid);

format(string, sizeof(string), "[Sheriff:] %s is now an on duty as a Sheriff",GetPlayerNameEx(playerid));
  SendFactionTypeMessage(1, COLOR_LSPD, string);
SafeGivePlayerWeapon(playerid, 3, 0);
SafeGivePlayerWeapon(playerid, 24, 70);
SafeGivePlayerWeapon(playerid, 41, 700);
return 1;
}
else
{
   if(PlayerInfo[playerid][pSex] == 1){
      // I moved this { to up there^
PlayerActionMessage(playerid,15.0,"clocks out as a Sheriff, and puts his equipment in the locker");
}
else
{
  PlayerActionMessage(playerid,15.0,"clocks out as a Sheriff, and puts her equipment in the locker");
}
CopOnDuty[playerid] = 0;
SetPlayerToFactionSkin(playerid);
SafeResetPlayerWeapons(playerid);
return 1;
}
}


  else
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] You are not at the duty position");
return 1;
}
}
  	 else
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] Invalid faction");
return 1;
}
}
return 1;
}
that should work now.


Re: /duty is bugged. need help - NiiRV4N4 - 14.04.2010

Quote:
Originally Posted by Steven82
Код:
PlayerToPoint,
can mean he directing to room, i bet if he use the code i just gave him off the

http://wiki.sa-mp.com

it would work, usually playertopoint is used for switching interior's.


EDIT:

Код:
if(strcmp(cmd, "/Sduty", true) == 0)
{
  if(IsPlayerConnected(playerid))
  {
if(PlayerInfo[playerid][pFaction] == 8)
{
if PlayerToPoint( 5.0, playerid, 326.48, 307.37, 999.15 )
{
if(CopOnDuty[playerid] == 0)
    {
      if(PlayerInfo[playerid][pSex] == 1)
      {
PlayerActionMessage(playerid,15.0,"clocks in as a Sheriff, and takes his equipment from the locker");
}
else
{
  PlayerActionMessage(playerid,15.0,"clocks in as a Sheriff, and takes her equipment from the locker");
}
SafeGivePlayerWeapon(playerid, 3, 0);
SafeGivePlayerWeapon(playerid, 24, 70);
SafeGivePlayerWeapon(playerid, 41, 700);
CopOnDuty[playerid] = 1;
SetPlayerToFactionSkin(playerid);
SetPlayerToFactionColor(playerid);

format(string, sizeof(string), "[Sheriff:] %s is now an on duty as a Sheriff",GetPlayerNameEx(playerid));
  SendFactionTypeMessage(1, COLOR_LSPD, string);
SafeGivePlayerWeapon(playerid, 3, 0);
SafeGivePlayerWeapon(playerid, 24, 70);
SafeGivePlayerWeapon(playerid, 41, 700);
return 1;
}
else
{
   if(PlayerInfo[playerid][pSex] == 1){
      // I moved this { to up there^
PlayerActionMessage(playerid,15.0,"clocks out as a Sheriff, and puts his equipment in the locker");
}
else
{
  PlayerActionMessage(playerid,15.0,"clocks out as a Sheriff, and puts her equipment in the locker");
}
CopOnDuty[playerid] = 0;
SetPlayerToFactionSkin(playerid);
SafeResetPlayerWeapons(playerid);
return 1;
}
}


  else
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] You are not at the duty position");
return 1;
}
}
  	 else
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] Invalid faction");
return 1;
}
}
return 1;
}
that should work now.
No, it won't work.

Quote:
Originally Posted by Kevin Fallow / KevKo
No, this would be correct.

pawn Код:
if(PlayerToPoint(5.0, playerid, 326.48, 307.37, 999.15))
thank you