SA-MP Forums Archive
[Ayuda] /lock ( Vehiculo ) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: [Ayuda] /lock ( Vehiculo ) (/showthread.php?tid=274361)



[Ayuda] /lock ( Vehiculo ) - Sergikoh - 05.08.2011

Necesito limitar el comando de mi vehiuclo cuando este cerca de йl.

Muchas Gracias!


Код:
if(strcmp(cmd, "/lock", true) == 0 || strcmp(cmd, "/lock", true) == 0) // By Ellis
 {
                new keycar = PlayerInfo[playerid][pPcarkey];
                if(keycar != 999)
                {
                    new locked[256];
                    locked = strtok(cmdtext, idx);
     if(CarInfo[keycar][cLock] == 1)
                    {
                     for(new i = 0; i < MAX_PLAYERS; i++)
      {
       if (IsPlayerConnected(i))
       {
        SetVehicleParamsForPlayer(keycar,i,0,0);
       }
      }
      format(string, sizeof(string), "~w~Coche~n~~g~Desbloqueado");
      GameTextForPlayer(playerid, string, 4000, 3);
      CarInfo[keycar][cLock] = 0;
      OnPropUpdate();
      return 1;
     }
     else if(CarInfo[keycar][cLock] == 0)
     {
         for(new i = 0; i < MAX_PLAYERS; i++)
      {
       if (IsPlayerConnected(i))
       {
        SetVehicleParamsForPlayer(keycar,i,0,1);
       }
      }
      format(string, sizeof(string), "~w~Coche~n~~r~Bloqueado");
      GameTextForPlayer(playerid, string, 4000, 3);
      CarInfo[keycar][cLock] = 1;
      OnPropUpdate();
      return 1;
     }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, " No tienes un vehнculo!");
                    return 1;
                }
         }



Respuesta: [Ayuda] /lock ( Vehiculo ) - TiNcH010 - 05.08.2011

Podrias usar algo asi xD
pawn Код:
for(new i; i != MAX_VEHICLES; i++)
                {
                    new dist = CheckPlayerDistanceToVehicle(3.5, playerid, i);
                    if(dist)
                    {
Lo demas y el mensaje seguilo xD


Respuesta: [Ayuda] /lock ( Vehiculo ) - Sergikoh - 05.08.2011

Perdona me puedes explicar como poner ese script, porfavor?


Respuesta: [Ayuda] /lock ( Vehiculo ) - TiNcH010 - 05.08.2011

Que podes modificarlo segun la distancia del auto, ej:
pawn Код:
new counter = 0;
                new result;

                for(new i; i != MAX_VEHICLES; i++)
                {
                    new dist = CheckPlayerDistanceToVehicle(3.5, playerid, i);
                    if(dist)
                    {
                        result = i;
                        counter++;
                    }
                }
                switch(counter)
                {
                    case 0:
                    {
                        SendClientMessage(playerid, COLOR_GREY, "No estas cerca del coche");
                    }