engine key
#1

how can i make this command (engine) with key??
How to turn on the engine with key "2" not /engine ?


pawn Код:
if (strcmp("/engine", cmdtext, true, 10) == 0)//your command.
    {
        new vehicleid = GetPlayerVehicleID(playerid);//defining vehicleid is = to GetPlayerVehicleID.
        new engine, lights, alarm, doors, bonnet, boot, objective;//these are the defines of the thing used in the command.
        if(IsPlayerInAnyVehicle(playerid))//This will check that if a player is in the vehicle or not.
            {
                if(GetPlayerVehicleSeat(playerid) == 0) //Now this will check that if a player is on the driving seat or not.
                {
                    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);//will check that what is the state of the engine.
                    if(engine == 1)//will check that if the wngine in on or not.
                    {
                        GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);//this will check that what is the state of engine.That is is on or off.We can use it for multiple things like doors,alarms etc.But In this case I am using this for the engine only.
                        SetVehicleParamsEx(vehicleid,false,lights,alarm,doors,bonnet,boot,objective);//when we change the engine and replace it with false,this will turn the vehicle engine off.Same if we make if true,this will make the engine on.
                        GameTextForPlayer(playerid,"Vehicle Engine Stopped!",2000,6);//for a text to appar on the screen for only 2 seconds.
                        return 1;
                    }
                    else
                    SetVehicleParamsEx(vehicleid,true,lights,alarm,doors,bonnet,boot,objective);//if vehicle engine is false it will change it to true.
                    GameTextForPlayer(playerid,"Vehicle Engine Started!",2000,6);//for a text to appar on the screen for only 2 seconds.
                }
                else SendClientMessage(playerid,-1,"Error: You are not at the driving seat!");//this is an error message,that if a player is not on the driving seat,this error message would appear.
                return 1;
            }
            else
            SendClientMessage(playerid,-1,"Error: You are not in a vehicle!");//this is the error message,that if a player is not in the car,the error message would apper.
    }
Reply
#2

OnPlayerKeyStateChange
Reply
#3

pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) // on top
then,

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (PRESSED(KEY_SUBMISSION))
    {
           // Your Code
           {
                // Your code
           }
       }
    }
    return 1;
}
Reply
#4

Quote:
Originally Posted by SilverKiller
Посмотреть сообщение
pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) // on top
then,

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (PRESSED(KEY_SUBMISSION))
    {
           // Your Code
           {
                // Your code
           }
       }
    }
    return 1;
}
can you make it with that command up ? i am geeting errors :@
Reply
#5

I using this filterscript http://www.mediafire.com/?o1fzy331h3u1k2o ( Od DW Forum e dobra e na 2 se pali motor )
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)