Combining Commands
#1

I need to combine commands together, but I have no idea how to start
I was /e to be associated with /eo is that when /e is used it will start the car, and if /e is used again, it will stop it

/e
Код:
CMD:e(playerid, params[])
{
    if(GetPlayerState(playerid) == 2) 
    {
        new vehicle = GetPlayerVehicleID(playerid); 
        if(Engine[vehicle] == 0)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective; 
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            Engine[vehicle] = 1; 
            SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, 0); 
        }
    }
    else return SendClientMessage(playerid, GREY, "You can't start a started car.");
	SendClientMessage(playerid, COLOR_YELLOW, "Use /eo to turn the engine off.");
    return 1;
}
/eo
Код:
CMD:eo(playerid, params[])
{
    #pragma unused params
    if(GetPlayerState(playerid) == 2) 
    {
        new vehicle = GetPlayerVehicleID(playerid);
        if(Engine[vehicle] == 1)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective; 
            Engine[vehicle] = 0;
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, 0);
        }
        else return SendClientMessage(playerid, GREY, "This vehicle's engine is already off.");
    }
    else return SendClientMessage(playerid, GREY, "You must be in the drivers seat of a vehicle.");
    return 1;
}
And I have been stumped on this for an hour

Can someone make it so that when using the following /hotwire script you CAN NOT turn the vehicle off?

Код:
CMD:hotwire(playerid, params[])
{
    if(GetPlayerState(playerid) == 2)
    {
        new vehicle = GetPlayerVehicleID(playerid);
        if(Engine[vehicle] == 0)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            Engine[vehicle] = 1;
            SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, 0);
        }
    }
    else return SendClientMessage(playerid, GREY, "You can't start a started car.");
	SendClientMessage(playerid, COLOR_YELLOW, "Use /eo to turn the engine off.");
    return 1;
}
Reply
#2

pawn Код:
CMD:e(playerid, params[])
{
        if(GetPlayerState(playerid) != 2)return SendClientMessage(playerid, GREY, "You can't start a started car.");
        new vehicle = GetPlayerVehicleID(playerid);
        if(Engine[vehicle] == 0)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            Engine[vehicle] = 1;
            SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, 0);
        }
        else if(Engine[vehicle] == 1)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective;
            Engine[vehicle] = 0;
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, 0);
        }
    return 1;
}
Reply
#3

Quote:
Originally Posted by DaRk_RaiN
Посмотреть сообщение
pawn Код:
CMD:e(playerid, params[])
{
        if(GetPlayerState(playerid) != 2)return SendClientMessage(playerid, GREY, "You can't start a started car.");
        new vehicle = GetPlayerVehicleID(playerid);
        if(Engine[vehicle] == 0)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            Engine[vehicle] = 1;
            SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, 0);
        }
        else if(Engine[vehicle] == 1)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective;
            Engine[vehicle] = 0;
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, 0);
        }
    return 1;
}
Thank you

Do you perhaps know how to make it so if you /hotwire you can't /e?
Reply
#4

So when this command is excicuted you can't turn off the engine?
Put this define under the includes
pawn Код:
new HotWired[MAX_VEHICLES];
pawn Код:
CMD:hotwire(playerid, params[])
{
        if(GetPlayerState(playerid) != 2)return SendClientMessage(playerid, GREY, "You must be a driver to use this command.");
        new vehicle = GetPlayerVehicleID(playerid);
        if(Engine[vehicle] == 1)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            Engine[vehicle] = 1;
            SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, 0);
            HotWired[vehicle] = 1;
            SendClientMessage(playerid, GREY, "Now you can't turn off your car?");
        }
    return 1;
}
If you this what you meant then you should also change the /e command to this
pawn Код:
CMD:e(playerid, params[])
{
        new vehicle = GetPlayerVehicleID(playerid);
        if(GetPlayerState(playerid) != 2)return SendClientMessage(playerid, GREY, "You can't start a started car.");
        if(HotWired[vehicle] == 1)return SendClientMessage(playerid, GREY, "This car you hot wired you can't turn it on or off");
        if(Engine[vehicle] == 0)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            Engine[vehicle] = 1;
            SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, 0);
        }
        else if(Engine[vehicle] == 1)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective;
            Engine[vehicle] = 0;
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, 0);
        }
    return 1;
}
Reply
#5

Quote:
Originally Posted by DaRk_RaiN
Посмотреть сообщение
So when this command is excicuted you can't turn off the engine?
Put this define under the includes
pawn Код:
new HotWired[MAX_VEHICLES];
pawn Код:
CMD:hotwire(playerid, params[])
{
        if(GetPlayerState(playerid) != 2)return SendClientMessage(playerid, GREY, "You must be a driver to use this command.");
        new vehicle = GetPlayerVehicleID(playerid);
        if(Engine[vehicle] == 1)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            Engine[vehicle] = 1;
            SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, 0);
            HotWired[vehicleid] = 1;
            SendClientMessage(playerid, GREY, "Now you can't turn off your car?");
        }
    return 1;
}
If you this what you meant then you should also change the /e command to this
pawn Код:
CMD:e(playerid, params[])
{
        if(GetPlayerState(playerid) != 2)return SendClientMessage(playerid, GREY, "You can't start a started car.");
        if(HotWired[vehicle] == 1)return SendClientMessage(playerid, GREY, "This car you hot wired you can't turn it on or off");
        new vehicle = GetPlayerVehicleID(playerid);
        if(Engine[vehicle] == 0)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            Engine[vehicle] = 1;
            SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, 0);
        }
        else if(Engine[vehicle] == 1)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective;
            Engine[vehicle] = 0;
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, 0);
        }
    return 1;
}
I entered

Код:
CMD:e(playerid, params[])
{
        if(GetPlayerState(playerid) != 2)return SendClientMessage(playerid, GREY, "You can't start a started car.");
        if(HotWired[vehicle] == 1)return SendClientMessage(playerid, GREY, "This car you hot wired you can't turn it on or off");
        new vehicle = GetPlayerVehicleID(playerid);
        if(Engine[vehicle] == 0)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            Engine[vehicle] = 1;
            SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, 0);
        }
        else if(Engine[vehicle] == 1)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective;
            Engine[vehicle] = 0;
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, 0);
        }
        return 1;
}
CMD:hotwire(playerid, params[])
{
        if(GetPlayerState(playerid) != 2)return SendClientMessage(playerid, GREY, "You must be a driver to use this command.");
        new vehicle = GetPlayerVehicleID(playerid);
        if(Engine[vehicle] == 1)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            Engine[vehicle] = 1;
            SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, 0);
            HotWired[vehicleid] = 1;
            SendClientMessage(playerid, GREY, "Now you can't turn off your car?");
        }
        return 1;
}
and got

Код:
C:\Users\Jason\Desktop\205.234.152.184_7780\gamemodes\OGRP.pwn(1534) : error 017: undefined symbol "vehicle"
C:\Users\Jason\Desktop\205.234.152.184_7780\gamemodes\OGRP.pwn(1562) : error 017: undefined symbol "vehicleid"
C:\Users\Jason\Desktop\205.234.152.184_7780\gamemodes\OGRP.pwn(1630) : error 017: undefined symbol "i"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
1534 =
Код:
if(HotWired[vehicle] == 1)return SendClientMessage(playerid, GREY, "This car you hot wired you can't turn it on or off");
1562 =
Код:
HotWired[vehicleid] = 1;
1630 = My own error, and I will deal with it.
Reply
#6

Also if you could

I want
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
   SendClientMessage(playerid, COLOR_YELLOW, "You have entered a vehicle ((TIP: Type /e to start it.))");
   return 1;
}
to only show up if you are the driver, I tried like GetPlayerstate =!PLAYER_STATE_DRIVER but it didn't work

I really appreciate the help you are doing for me.
Reply
#7

Code fixed above.
Also:
!= means is he is NOT a driver check
When you should have used ==
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
   if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER )
{
   SendClientMessage(playerid, COLOR_YELLOW, "You have entered a vehicle ((TIP: Type /e to start it.))");
}
   return 1;
}
Reply
#8

Quote:
Originally Posted by xXRealLegitXx
Посмотреть сообщение
I entered

Код:
CMD:e(playerid, params[])
{
        if(GetPlayerState(playerid) != 2)return SendClientMessage(playerid, GREY, "You can't start a started car.");
        if(HotWired[vehicle] == 1)return SendClientMessage(playerid, GREY, "This car you hot wired you can't turn it on or off");
        new vehicle = GetPlayerVehicleID(playerid);
        if(Engine[vehicle] == 0)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            Engine[vehicle] = 1;
            SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, 0);
        }
        else if(Engine[vehicle] == 1)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective;
            Engine[vehicle] = 0;
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, 0);
        }
        return 1;
}
CMD:hotwire(playerid, params[])
{
        if(GetPlayerState(playerid) != 2)return SendClientMessage(playerid, GREY, "You must be a driver to use this command.");
        new vehicle = GetPlayerVehicleID(playerid);
        if(Engine[vehicle] == 1)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            Engine[vehicle] = 1;
            SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, 0);
            HotWired[vehicleid] = 1;
            SendClientMessage(playerid, GREY, "Now you can't turn off your car?");
        }
        return 1;
}
and got

Код:
C:\Users\Jason\Desktop\205.234.152.184_7780\gamemodes\OGRP.pwn(1534) : error 017: undefined symbol "vehicle"
C:\Users\Jason\Desktop\205.234.152.184_7780\gamemodes\OGRP.pwn(1562) : error 017: undefined symbol "vehicleid"
C:\Users\Jason\Desktop\205.234.152.184_7780\gamemodes\OGRP.pwn(1630) : error 017: undefined symbol "i"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
1534 =
Код:
if(HotWired[vehicle] == 1)return SendClientMessage(playerid, GREY, "This car you hot wired you can't turn it on or off");
1562 =
Код:
HotWired[vehicleid] = 1;
1630 = My own error, and I will deal with it.
I think I've found an error:

Everywhere it's written: Engine[vehicle],... but then for HotWire you suddenly use vehicleid, so change it to this:

pawn Код:
HotWire[vehicle] = 1;
EDIT: and to fix the other error at /e, put the variable vehicle BEFORE everything else, that should fix it, so not this:

pawn Код:
if(GetPlayerState(playerid) != 2)return SendClientMessage(playerid, GREY, "You can't start a started car.");
        if(HotWired[vehicle] == 1)return SendClientMessage(playerid, GREY, "This car you hot wired you can't turn it on or off");
        new vehicle = GetPlayerVehicleID(playerid);
But this:

pawn Код:
new vehicle = GetPlayerVehicleID(playerid);
       if(GetPlayerState(playerid) != 2)return SendClientMessage(playerid, GREY, "You can't start a started car.");
        if(HotWired[vehicle] == 1)return SendClientMessage(playerid, GREY, "This car you hot wired you can't turn it on or off");
Reply
#9

Quote:
Originally Posted by Da_Noob
Посмотреть сообщение
I think I've found an error:

Everywhere it's written: Engine[vehicle],... but then for HotWire you suddenly use vehicleid, so change it to this:

pawn Код:
HotWire[vehicle] = 1;
EDIT: and to fix the other error at /e, put the variable vehicle BEFORE everything else, that should fix it, so not this:

pawn Код:
if(GetPlayerState(playerid) != 2)return SendClientMessage(playerid, GREY, "You can't start a started car.");
        if(HotWired[vehicle] == 1)return SendClientMessage(playerid, GREY, "This car you hot wired you can't turn it on or off");
        new vehicle = GetPlayerVehicleID(playerid);
But this:

pawn Код:
new vehicle = GetPlayerVehicleID(playerid);
       if(GetPlayerState(playerid) != 2)return SendClientMessage(playerid, GREY, "You can't start a started car.");
        if(HotWired[vehicle] == 1)return SendClientMessage(playerid, GREY, "This car you hot wired you can't turn it on or off");
I did:

Код:
CMD:hotwire(playerid, params[])
{
        if(GetPlayerState(playerid) != 2)return SendClientMessage(playerid, GREY, "You must be a driver to use this command.");
        new vehicle = GetPlayerVehicleID(playerid);
        if(Engine[vehicle] == 1)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            Engine[vehicle] = 1;
            SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, 0);
            HotWired[vehicle] = 1;
            SendClientMessage(playerid, GREY, "Now you can't turn off your car?");
        }
        return 1;
}
and got

Код:
C:\Users\Jason\Desktop\205.234.152.184_7780\gamemodes\OGRP.pwn(1556) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#10

NEVERMIND
Found the error was a leftover */

Thanks for the help guys

EDIT: Whenever I do /hotwire in a car, it doesnt work. BUT when I do it outside a car, it says You must be a driver
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)