When Engine starts ,
#1

I gots This
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    new vehicleid = GetPlayerVehicleID(playerid);
   
    if(IsPlayerInAnyVehicle(playerid))
    {
        if(vehEngine[vehicleid] == 0)
        {
            if(newkeys == KEY_JUMP)
            {
                vehEngine[vehicleid] = 2;
                SetTimerEx("StartEngine", 3000, 0, "i", playerid);
                SendClientMessage(playerid, 0x33AA33AA, "Vehicle engine starting");
               
            }
        }
        if(newkeys == KEY_SECONDARY_ATTACK)
        {
            RemovePlayerFromVehicle(playerid);
            TogglePlayerControllable(playerid, 1);
        }
    }
    return 1;
}
After Engine starts i want an automatic /me ,%s(Player name) spins the %s(car name)'s key into the ignition and turns on the engine.
Reply
#2

anyone ?
Reply
#3

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    new vehicleid = GetPlayerVehicleID(playerid);
   
    if(IsPlayerInAnyVehicle(playerid))
    {
        if(vehEngine[vehicleid] == 0)
        {
            if(newkeys == KEY_JUMP)
            {
                new str[128], Name[MAX_PLAYER_NAME], pPos[3];
                GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
                GetPlayerName(playerid, Name, sizeof Name);
                format(str, sizeof str, "%s started the vehicle engine.", Name);
                for (new i = 0;  i<MAX_PLAYERS;  i++)
                {
                          if(IsPlayerInRangeOfPoint(i, 20, Pos[0], Pos[1], Pos[2]))
                                        SendClientMessage(i, 0xF9B7FFAA, str);
                 }
                vehEngine[vehicleid] = 2;
                SetTimerEx("StartEngine", 3000, 0, "i", playerid);
                SendClientMessage(playerid, 0x33AA33AA, "Vehicle engine starting");
                return 1;
            }
        }
        if(newkeys == KEY_SECONDARY_ATTACK)
        {
            RemovePlayerFromVehicle(playerid);
            TogglePlayerControllable(playerid, 1);
        }
    }
    return 1;
}
Reply
#4

I get these


C:\DOCUME~1\Jaber\Bureau\BASICR~1\FILTER~1\engine. pwn(63) : error 017: undefined symbol "Pos"
C:\DOCUME~1\Jaber\Bureau\BASICR~1\FILTER~1\engine. pwn(63) : warning 215: expression has no effect
C:\DOCUME~1\Jaber\Bureau\BASICR~1\FILTER~1\engine. pwn(63) : error 001: expected token: ";", but found "]"
C:\DOCUME~1\Jaber\Bureau\BASICR~1\FILTER~1\engine. pwn(63) : error 029: invalid expression, assumed zero
C:\DOCUME~1\Jaber\Bureau\BASICR~1\FILTER~1\engine. pwn(63) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#5

the line 63 is ?
Reply
#6

Hi Jaber_Brown,

If you already have a /me command defined you could try the following:
pawn Код:
OnPlayerCommandText(playerid,"/me starts the engine");
A quick and simple solution, just put it inside your command.

Cheers,

TJ
Reply
#7

Ok, Another thing, Even Players who seat in back seat can turn on/off the engine, how can i make only ppl who are in the driver seat can turn it on
Reply
#8

Hi Again Jaber,

Adding the following if statement should prevent that:
pawn Код:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{

    //Do Something...

}
Cheers,

TJ
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)