/ftow problem
#1

So, today I started to figure out a /ftow command. However, the cars that should respawn doesn't do it.


Код:
if(strcmp(cmd, "/ftow", true) ==0)
	{
	  if(PlayerInfo[playerid][LoggedIn] == 1)
	  {
		if(PlayerInfo[playerid][Faction] == 1)
		{
		  if(PlayerInfo[playerid][Rank] >= 4)
		  {
            for(new i = 0;i<MAX_CARS;i++)
            {
            if(CarSystem[i][Carowner] == PlayerInfo[playerid][Faction])
            {
              SetVehicleToRespawn(i);
              SendClientMessage(playerid, COLOR_WHITE, "You have successfully faction towed your faction vehicles");
			  return 1;
			  }
			}
		  }
		  else return SendClientMessage(playerid, COLOR_RED, "You need to be aleast rank 4 to faction tow.");
		  }
		else return SendClientMessage(playerid, COLOR_RED, "You are not in a faction.");
	   }
	   else return SendClientMessage(playerid, COLOR_RED, "You need to be logged in to perform this command.");
      return 1;
      }
Reply
#2

You want to use

https://sampwiki.blast.hk/wiki/GetPlayerVehicleID, you don't want to check all the vehicles to see which one you are in.
Reply
#3

I thought GetPlayerVehicleID was made to check the ID of the vehicle you sit in.
Reply
#4

Well you get get the vehicle ID and then use it in SetVehicleToRespawn

For example:
pawn Код:
if(strcmp(cmd, "/respawnthiscar", true) == 0 || strcmp(cmd, "/rtc", true) == 0) // by Ellis
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] < 2 )
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
                return 1;
            }
            if(IsPlayerInAnyVehicle(playerid))
            {
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, 256, "AdmWarning: %s has just respawned vehicle id %d.",sendername,GetPlayerVehicleID(playerid));
                ABroadCast(COLOR_YELLOW,string,1);
                SetVehicleToRespawn(GetPlayerVehicleID(playerid));
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_GREY, "   Vehicle Respawned !");
            }
        }
        return 1;
    }
EIDT: I know it is out of LARP but this is just to show an example.
Reply
#5

You seem to not understand the idea. The /ftow is mean't to respawn all of the vehicles that belongs to faction 1. Which means you can't use GetPlayervehicleID. It's about 8 vehicles.
Reply
#6

Ohhh.. Then I don't know what is wrong. It looks right.
Reply
#7

Bumping, does anyone know?
Reply
#8

Bump once again...
Reply
#9

pawn Код:
if(strcmp(cmd, "/ftow", true) ==0)
{
    if(PlayerInfo[playerid][LoggedIn] == 1)
    {
        if(PlayerInfo[playerid][Faction] == 1)
        {
            if(PlayerInfo[playerid][Rank] >= 4)
            {
                for(new i = 0;i<MAX_CARS;i++)
                {
                    if(CarSystem[i][Carowner] == PlayerInfo[playerid][Faction])
                    {
                        SetVehicleToRespawn(i+1);
                    }
                }
                SendClientMessage(playerid, COLOR_WHITE, "You have successfully faction towed your faction vehicles");
            }
            else return SendClientMessage(playerid, COLOR_RED, "You need to be aleast rank 4 to faction tow.");
        }
        else return SendClientMessage(playerid, COLOR_RED, "You are not in a faction.");
    }
    else return SendClientMessage(playerid, COLOR_RED, "You need to be logged in to perform this command.");
    return 1;
}
Try this.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)