OnPlayerEnterVehicle to OnPlayerStateChange
#1

Solved




Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if (vehicleid == 562)
    {
        AddVehicleComponent(562, 1010); // Nitro
        SendClientMessage(playerid, 0xFFFFFFAA, "Nitro Added.");
    }
    return 1;
}
Код:
2 Player is driver of a vehicle - "PLAYER_STATE_DRIVER"
Reply
#2

You already have the biggest part

pawn Код:
public OnPlayerStateChange(playerid, oldstate, newstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)   //Equals "if player enters a vehicle as driver"
    {
        if (GetPlayerVehicleID(playerid) == 562)   //vehicleid is not provided, so get it like this
        {
            AddVehicleComponent(562, 1010); // Nitro
            SendClientMessage(playerid, 0xFFFFFFAA, "Nitro Added.");
        }
    }
    return 1;
}
Reply
#3

Argh.It's not working man :/

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)   //Equals "if player enters a vehicle as driver"
    {
    if (GetPlayerVehicleID(playerid) == 562)   //vehicleid is not provided, so get it like this
    {
    AddVehicleComponent(562, 1010); // Nitro
    SendClientMessage(playerid, 0xFFFFFFAA, "Nitro Added.");
       }
    }
	return 1;
}
i get one warning but that doesn't matter does it.
Quote:

C:\DOCUME~1\Barteka\Desktop\SA-MPS~1\GAMEMO~1\NOSSDR~1.PWN(257) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.

Reply
#4

jhfglзjbpз
Reply
#5

Quote:
Originally Posted by DainMokan
Посмотреть сообщение
jhfglзjbpз
Wtf?

Anyways:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)   //Equals "if player enters a vehicle as driver"
    {
        if (GetPlayerVehicleID(playerid) == 562)   //vehicleid is not provided, so get it like this
        {
            AddVehicleComponent(562, 1010); // Nitro
            SendClientMessage(playerid, 0xFFFFFFAA, "Nitro Added.");
        }
    }
    return 1;
}
Now there is no warning. :P
Reply
#6

You are all wrong. If he means vehicle MODEL id 562 (Elegy), use this:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)  
    {
        if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 562)  
        {
            AddVehicleComponent(562, 1010); // Nitro
            SendClientMessage(playerid, 0xFFFFFFAA, "Nitro Added.");
        }
    }
    return 1;
}
Reply
#7

Oops, sorry, I did not pay attention to this. Whatever, your code is still not 100% correct, you try to add the component to 562, not to the player's vehicle id

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)  
    {
        if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 562)  
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid), 1010); // Nitro
            SendClientMessage(playerid, 0xFFFFFFAA, "Nitro Added.");
        }
    }
    return 1;
}
Reply
#8

Indeed, yes. My mistake
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)