Jump to content
  • 0

Comanda /hac


mR.KerigaN

Question

Nick: mR.KerigaN

Problema: am o problema la comanda /hac care repara toate masinile dupa server cand dau /hac repara doar masinile care sunt conduse

Erori / warnings: nu imi da erori

Lini/script: if(strcmp(cmd, "/hac", true) == 0 ||strcmp(cmd, "/hac", true) == 0)

{

    GetPlayerName(playerid, sendername, sizeof(sendername));

    if(IsPlayerConnected(playerid))

    {

        if(AdminDuty[playerid] == 1 && PlayerInfo[playerid][pAdmin] >= 1||HelperDuty[playerid] == 1 && PlayerInfo[playerid][pHelper] >= 2 )

        {

        //format(string, sizeof(string), "{FFFFFF}Admin{FF9900} %s {FFFFFF}has repair all cars.", sendername);

    //SendClientMessageToAll(0xFF7171FF, string);

    new Float:x, Float:y, Float:z;

    GetPlayerPos(playerid,x,y,z);

            for(new i = 0; i < MAX_PLAYERS; i ++)

{

    if(IsPlayerConnected(i))

    {

                    if(IsPlayerInRangeOfPoint(i, 30000000000000000000000000000000000000000000000000000000000, x, y, z))

    {

        RepairCar = GetPlayerVehicleID(i);

    SetVehicleHealth(i, 1000.0);

    RepairVehicle(RepairCar);

    format(string, sizeof(string), "{FF0000} %s {FFFFFF}repaired all cars.", sendername);

    SendClientMessage(i,0xFF7171FF, string);

}

}

}

}

else

{

    SendClientMessage(playerid, COLOR_RED, "Nu esti Helper/Admin on Duty!");

}

}

else

{

    SendClientMessage(playerid, COLOR_RED, "You Must be logged in to use this command!");

}

return 1;

}

Ai incercat sa rezolvi singur ?: Da

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Salut,incearca:

[pawn]if(strcmp(cmd, "/hac", true) == 0 ||strcmp(cmd, "/hac", true) == 0)

  {

      GetPlayerName(playerid, sendername, sizeof(sendername));

      if(IsPlayerConnected(playerid))

      {

          if(AdminDuty[playerid] == 1 && PlayerInfo[playerid][pAdmin] >= 1||HelperDuty[playerid] == 1 && PlayerInfo[playerid][pHelper] >= 2 )

          {

              //format(string, sizeof(string), "{FFFFFF}Admin{FF9900} %s {FFFFFF}has repair all cars.", sendername);

            //SendClientMessageToAll(0xFF7171FF, string);

            new Float:x, Float:y, Float:z;

            GetPlayerPos(playerid,x,y,z);

              for(new i = 0; i < MAX_PLAYERS; i ++)

            {

                if(IsPlayerConnected(i))

                {

                      if(IsPlayerInRangeOfPoint(i, 30000000000000000000000000000000000000000000000000000000000, x, y, z))

                  {

                      SetVehicleHealth(i, 1000.0);

                      RepairVehicle(RepairCar);

                      format(string, sizeof(string), "{FF0000} %s {FFFFFF}repaired all cars.", sendername);

                      SendClientMessage(i,0xFF7171FF, string);

                  }

              }

            }

        }

        else

        {

            SendClientMessage(playerid, COLOR_RED, "Nu esti Helper/Admin on Duty!");

        }

      }

      else

      {

          SendClientMessage(playerid, COLOR_RED, "You Must be logged in to use this command!");

      }

      return 1;

  }[/pawn]

 

 

Link to comment
Share on other sites

native IsValidVehicle(vehicleid); //asta adaugi la inceputul gamemode-ului/script-ului

if(strcmp(cmd, "/hac", true) == 0)
{
	if(!(IsPlayerConnected(playerid))) return SendClientMessage(playerid, COLOR_RED, "You Must be logged in to use this command!");
	if(!(AdminDuty[playerid] == 1 && PlayerInfo[playerid][pAdmin] >= 1||HelperDuty[playerid] == 1 && PlayerInfo[playerid][pHelper] >= 2 )) return SendClientMessage(playerid, COLOR_RED, "Nu esti Helper/Admin on Duty!");
	new numeadmin[MAX_PLAYER_NAME];
	GetPlayerName(playerid, numeadmin, sizeof(numeadmin));
	for(new i = 1; i < MAX_VEHICLES; i++)
	{
		if(IsValidVehicle(i))
		{
			SetVehicleHealth(i, 1000.0);
			RepairVehicle(i);
		}	
	}	
	format(string, sizeof(string), "Toate vehiculele au fost reparate de catre %s (/hac)",numeadmin);
	SendClientMessageToAll(COLOR_RED, string);
	return 1;
}

 

1859311972_BANNER-GIREADAcopy-min.thumb.png.48e5e420ae2185dce5b244965a1d2601.png

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.