SA-MP Forums Archive
Ayuda con comando /noconducir - 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 con comando /noconducir (/showthread.php?tid=556906)



Ayuda con comando /noconducir - FlavioCesar - 12.01.2015

Hola, tengo este comando para no permitir conducir y tal, pero sucede que cuando lo pongo y el jugador esta conduciendo no le hace efecto, hay que esperar a que se baje, y ademбs que cuando presiona enter para subir al vehiculo le hace una especie de slap, no quiero que pase eso y que cuando este conduciendo y se le aplique el comando de una vez lo baje del coche. Ayuda por favor, їcomo se hace?
pawn Код:
dcmd_noconducir( playerid, params[]) {
    new jugadorid;
    new str[124+MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(str, sizeof(str), "%s NO PUEDE CONDUCIR", name);
    SendClientMessageToAll(-1, str);
    if(sscanf(params, "u", jugadorid)) return SendClientMessage(playerid, -1, "Error: el uso correcto es /noconducir (id)");
    noconducir[jugadorid] = true;
    return true;
}



Respuesta: Ayuda con comando /noconducir - Zume - 12.01.2015

Funciуn que buscas: https://sampwiki.blast.hk/wiki/RemovePlayerFromVehicle


Respuesta: Ayuda con comando /noconducir - jotajeda - 12.01.2015

pawn Код:
dcmd_noconducir( playerid, params[])
{
    new jugadorid;
    new str[68], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(str, sizeof(str), "%s NO PUEDE CONDUCIR", name);
    SendClientMessageToAll(-1, str);
    if(sscanf(params, "u", jugadorid)) return SendClientMessage(playerid, -1, "Error: el uso correcto es /noconducir (id)");
    if(!IsPlayerConnected(jugadorid)) return SendClientMessage(playerid, -1, "Jugador no conectado");
    RemovePlayerFromVehicle(jugadorid);
    noconducir[jugadorid] = true;
    return true;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) //entra a los vehiculos
{
    if(!ispassenger)
    {
        if(noconducir[jugadorid] == true)
        {
            RemovePlayerFromVehicle(playerid);
            new Float:x, Float:y, Float:z;
            GetPlayerPos(playerid, x, y, z);
            SetPlayerPos(playerid, x, y, z);
        }
    }
    return true;
}



Respuesta: Ayuda con comando /noconducir - FlavioCesar - 12.01.2015

Quote:
Originally Posted by _Zume
Посмотреть сообщение
Ya tengo esa funciуn en OnPlayerStateChange
pawn Код:
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        if(noconducir[playerid] == true)
        {
            RemovePlayerFromVehicle(playerid);
        }
    }



Respuesta: Ayuda con comando /noconducir - Zume - 12.01.2015

pawn Код:
RemovePlayerFromVehicleEx(playerid)
{
    if(!IsPlayerInAnyVehicle(playerid))
        return 0;

    new Float:X, Float:Y, Float:Z;
    RemovePlayerFromVehicle(playerid);
    GetPlayerPos(playerid, X, Y, Z);
    SetPlayerPos(playerid, X, Y, Z+2);
    return 1;
}



Respuesta: Ayuda con comando /noconducir - jotajeda - 12.01.2015

Quote:
Originally Posted by FlavioCesar
Посмотреть сообщение
Ya tengo esa funciуn en OnPlayerStateChange
pawn Код:
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        if(noconducir[playerid] == true)
        {
            RemovePlayerFromVehicle(playerid);
        }
    }
Aсadele
pawn Код:
new Float:x, Float:y, Float:z;
            GetPlayerPos(playerid, x, y, z);
            SetPlayerPos(playerid, x, y, z);



Respuesta: Ayuda con comando /noconducir - FlavioCesar - 12.01.2015

Ahora al intentar subir no me deja, el vehiculo hace como un rebote ahi, estб bien.. pero... aъn sigue sin hacer efecto inmediato cuando el jugador estй en un vehiculo xD. Debo esperar a que se baje para que no pueda subir mбs.


Respuesta: Ayuda con comando /noconducir - Zume - 12.01.2015

Supongo que es por que debes cargar las animaciones previamente, segъn he leнdo la funciуn tiene un bug, intenta ejecutar la funciуn dos veces (Esto en caso de que uses RemovePlayerFromVehicle y no RemovePlayerFromVehicleEx).


Respuesta: Ayuda con comando /noconducir - jotajeda - 12.01.2015

pawn Код:
dcmd_noconducir( playerid, params[])
{
    new jugadorid;
    new str[68], name[MAX_PLAYER_NAME],Float:x, Float:y, Float:z;
    GetPlayerName(playerid, name, sizeof(name));
    format(str, sizeof(str), "%s NO PUEDE CONDUCIR", name);
    SendClientMessageToAll(-1, str);
    if(sscanf(params, "u", jugadorid)) return SendClientMessage(playerid, -1, "Error: el uso correcto es /noconducir (id)");
    if(!IsPlayerConnected(jugadorid)) return SendClientMessage(playerid, -1, "Jugador no conectado");
    RemovePlayerFromVehicle(jugadorid);
    GetPlayerPos(playerid, x, y, z);
    SetPlayerPos(playerid, x, y, z+3);
    noconducir[jugadorid] = true;
    return true;
}



Respuesta: Ayuda con comando /noconducir - FlavioCesar - 12.01.2015

Gracias a los dos, en especial a jotajeda.