This code doesn't work [HELP]
#1

This code doesn't work, i even set my Job to 1 here is the pawn code

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(vehicleid == 420 || vehicleid == 438)
    {
        if(pInfo[playerid][JobMember] > 1 || pInfo[playerid][JobLeader] > 1)
        {
            SendClientMessage(playerid, COLOR_GREY, "/duty to be on/off Job Duty!");
            return 1;
        } else {
            SendClientMessage(playerid, COLOR_GREY, "  You are not Taxi Driver!  ");
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
Reply
#2

OnPlayerEnterVehicle is called when you START to enter a vehicle. Use OnPlayerKeyStateChange. Also, the vehicle ID is NOT the modelid.
Reply
#3

i search on ****** 'SAMP vehicleid' but i find the same vehicleid can you tell me what is the vehicleid of:

Taxi
Cabble
Reply
#4

https://sampwiki.blast.hk/wiki/Category:Vehicle
Reply
#5

At top of script
Код:
new Taxi1;
Under Gamemodeint
Код:
Taxi1 = CreateVehicle(   * Car Cordinates *
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new vid = GetPlayerVehicleID(playerid);
        if(vid == Taxi1 && PInfo[playerid][JOB] != 1) // Change *Taxi* to Car Id and Pinfo into your playervariables
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, COLOR_GREY, "This car belongs to Fort Carson News.");
        }
      return 1;
}
    }
Reply
#6

it still doesn't work
Reply
#7

idk but still doesn't work

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new vid = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_PASSENGER || newstate == PLAYER_STATE_DRIVER) return SetPlayerArmedWeapon(playerid, 0);
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(vid == Taxi || vid == Cabble && pInfo[playerid][JobMember] != 1 && pInfo[playerid][JobLeader] != 1)
        {
            SendClientMessage(playerid, COLOR_GREY, "  You are not Taxi Driver!  ");
            RemovePlayerFromVehicle(playerid);
            return 1;
        } else if(pInfo[playerid][JobMember] == 1 && pInfo[playerid][JobLeader] == 1)
        {
            SendClientMessage(playerid, COLOR_GREY, "/duty to be on/off Job Duty!");
        }
    }
    return 1;
}
Reply
#8

if(newstate == PLAYER_STATE_PASSENGER || newstate == PLAYER_STATE_DRIVER) return SetPlayerArmedWeapon(playerid, 0);

'RETURN' stops the code.
Reply
#9

nothing happens even i make this

pawn Код:
new vid = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_DRIVER && vid == Taxi || vid == Cabble)
    {
        if(pInfo[playerid][JobMember] != 1 && pInfo[playerid][JobLeader] != 1) {
            SendClientMessage(playerid, COLOR_GREY, "  You are not Taxi Driver!  ");
            RemovePlayerFromVehicle(playerid);
            return 1;
        } else if(pInfo[playerid][JobMember] == 1 && pInfo[playerid][JobLeader] == 1) {
            SendClientMessage(playerid, COLOR_GREY, "/duty to be on/off Job Duty!");
        }
    }
    if(newstate == PLAYER_STATE_PASSENGER || newstate == PLAYER_STATE_DRIVER)
    {
        SetPlayerArmedWeapon(playerid, 0);
        return 1;
    }
Reply
#10

Sigh.

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new vid = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_PASSENGER || newstate == PLAYER_STATE_DRIVER) SetPlayerArmedWeapon(playerid, 0);
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(GetVehicleModel(vid) == 420 || GetVehicleModel(vid) == 438) // Entered taxi
        {
            if(pInfo[playerid][JobMember] != 1 && pInfo[playerid][JobLeader] != 1)
            {
                SendClientMessage(playerid, COLOR_GREY, "  You are not a Taxi Driver!  ");
                RemovePlayerFromVehicle(playerid);
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "/duty to be on/off Job Duty!");
            }
        }
    }
    return 1;
}
Try that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)