[AJUDA] Respawncar Carros
#1

Como faзo para dar respawn nos carros que os players nгo estгo usando, tipo, se um player estб usando um veнculo o carro dele nгo ira ser respawnado!? e como coloco um tempo para os carros respawnarem automaticamente?

Cуdigo que uso:

pawn Код:
if(!strcmp(cmdtext, "/respawncar", true))
    {
        for(new i = 0; i < MAX_VEHICLES; i++)
        {
         SetVehicleToRespawn(i);
        }
        return 1;
     }
Reply
#2

pawn Код:
if(!strcmp(cmdtext, "/respawncar", true))
{
    for(new i = 0; i < MAX_VEHICLES; i++)
    {
        if(!GetVehicleDriver(i)) SetVehicleToRespawn(i);
    }
    return 1;
}

stock GetVehicleDriver(vehicleid)
{
  for(new i; i<MAX_PLAYERS; i++)
  {
    if (IsPlayerInVehicle(i, vehicleid))
    {
      if(GetPlayerState(i) == 2)
      {
            return i;
      }
    }
  }
  return -1;
}
Reply
#3

Quote:
Originally Posted by cynic
Посмотреть сообщение
pawn Код:
if(!strcmp(cmdtext, "/respawncar", true))
{
    for(new i = 0; i < MAX_VEHICLES; i++)
    {
        if(!GetVehicleDriver(i)) SetVehicleToRespawn(i);
    }
    return 1;
}

stock GetVehicleDriver(vehicleid)
{
  for(new i; i<MAX_PLAYERS; i++)
  {
    if (IsPlayerInVehicle(i, vehicleid))
    {
      if(GetPlayerState(i) == 2)
      {
            return i;
      }
    }
  }
  return -1;
}
pawn Код:
C:\Documents and Settings\Administrador\Desktop\AD 0.3c\gamemodes\MediumAD.pwn(3091) : warning 202: number of arguments does not match definition
C:\Documents and Settings\Administrador\Desktop\AD 0.3c\gamemodes\MediumAD.pwn(3100) : error 017: undefined symbol "GetVehicleDriver"
C:\Documents and Settings\Administrador\Desktop\AD 0.3c\gamemodes\MediumAD.pwn(3105) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrador\Desktop\AD 0.3c\gamemodes\MediumAD.pwn(3105) : error 017: undefined symbol "GetVehicleDriver"
C:\Documents and Settings\Administrador\Desktop\AD 0.3c\gamemodes\MediumAD.pwn(3109) : error 017: undefined symbol "vehicleid"
C:\Documents and Settings\Administrador\Desktop\AD 0.3c\gamemodes\MediumAD.pwn(3120) : warning 225: unreachable code
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Reply
#4

Era pra ter colocado a funзгo (o que estб a partir de "stock") no final do gamemode, achei que vocк sabia por isso nгo falei.
Reply
#5

pior, agora que eu fui ver que era stock
Reply
#6

nгo funciono, eu entrei no carro e dei respawncar e o carro respawno
Reply
#7

pawn Код:
forward IsVehicleOccupied(vehicleid);
pawn Код:
if(strcmp(cmd, "/respawncars", true) == 0)
    {
      if (IsPlayerAdmin(playerid))
      {
         for(new i=0;i<MAX_VEHICLES;i++)
         {
             if(IsVehicleOccupied(i) == 0)
             {
                 SetVehicleToRespawn(i);
            }
         }
         SendClientMessageToAll(0xFF6A6AFF, "Todos os veнculos foram respawnados!");
      }
      else
      {
         SendClientMessage(playerid, 0xFF6A6AFF, "Vocк nгo pode usar esse comando!");
      }
      return 1;
    }
pawn Код:
public IsVehicleOccupied(vehicleid)
{
   for(new i=0;i<MAX_PLAYERS;i++)
   {
      if(IsPlayerInVehicle(i,vehicleid)) return 1;
   }
   return 0;
}
Reply
#8

pawn Код:
if(strcmp(cmd, "/dcarro", true) == 0 || strcmp(cmd, "/dc", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] < 1)
            {
                SendClientMessage(playerid, COLOR_RED, "Vocк nгo estб autorizado a usar este comando!");
                return 1;
            }
            new vehicleid;
            vehicleid = GetPlayerVehicleID(playerid);
            GetPlayerName(playerid, playername, sizeof(playername));
            format(string, sizeof(string), "admCMD: O adminstrador %s deletou um veнculo.", playername);
            SendClientMessageToAll(COLOR_BLUE,string);
            DestroyVehicle(vehicleid);
        }
        return 1;
    }
EU USO ESSE=D
Reply
#9

Quote:
Originally Posted by Ambrуsio
Посмотреть сообщение
pawn Код:
forward IsVehicleOccupied(vehicleid);
pawn Код:
if(strcmp(cmd, "/respawncars", true) == 0)
    {
      if (IsPlayerAdmin(playerid))
      {
         for(new i=0;i<MAX_VEHICLES;i++)
         {
             if(IsVehicleOccupied(i) == 0)
             {
                 SetVehicleToRespawn(i);
            }
         }
         SendClientMessageToAll(0xFF6A6AFF, "Todos os veнculos foram respawnados!");
      }
      else
      {
         SendClientMessage(playerid, 0xFF6A6AFF, "Vocк nгo pode usar esse comando!");
      }
      return 1;
    }
pawn Код:
public IsVehicleOccupied(vehicleid)
{
   for(new i=0;i<MAX_PLAYERS;i++)
   {
      if(IsPlayerInVehicle(i,vehicleid)) return 1;
   }
   return 0;
}
pawn Код:
C:\Documents and Settings\Administrador\Desktop\AD 0.3c\gamemodes\MediumAD.pwn(3048) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrador\Desktop\AD 0.3c\gamemodes\MediumAD.pwn(3048) : error 017: undefined symbol "vehicleid"
C:\Documents and Settings\Administrador\Desktop\AD 0.3c\gamemodes\MediumAD.pwn(3111) : warning 202: number of arguments does not match definition
C:\Documents and Settings\Administrador\Desktop\AD 0.3c\gamemodes\MediumAD.pwn(5682) : warning 235: public function lacks forward declaration (symbol "IsVehicleOccupied")
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
Reply
#10

simpes:

No Comando...
pawn Код:
if(strcmp(cmd, "/respawncars", true) == 0)
{
       ResetarVeiculos();
       return true;
}
pawn Код:
stock ResetarVeiculos()
{
    new string[128]="Os Veнculos forгo Respawnados Automaticamente";
    SendClientMessageToAll(Aviso, string);
    new inVeh;
    for( new i = 0; i < MAX_VEHICLES; i++ )
    {
        inVeh = false;
        for( new j = 0; j < MAX_PLAYERS; j++ )
        {
            if(IsPlayerInVehicle( j, i ))
            {
                inVeh = true;
                break;
            }
        }
        if(!inVeh)
        {
            SetVehicleToRespawn(i);
        }
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)