This /engine command doesn't work :S
#1

Help me :
It uses the 0.3c engine system. It displayes "you are not in a car" if you are not in a car and typing /engine. But when you go in a car and type /engine, it doesnt do anything. :S
pawn Код:
//Look =======

    if(strcmp(cmd, "/engine", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
            {
                SendClientMessage(playerid,COLOR_GREY," You are not even inside a vehicle !");
                return 1;
            }
            if (IsNotAEngineCar(idcar))
            {
                SendClientMessage(playerid,COLOR_GREY," This vehicle doesn't even have an Engine !");
                return 1;
            }
            if(idcar >= 135 && idcar <= 155)
            {
                if(HireCar[playerid] != idcar)
                {
                    return 1;
                }
            }
            if(idcar >= 1 && idcar <= 9 || idcar >= 194 && idcar <= 196 || idcar >= 203 && idcar <= 205)
            {
                if(HireCar[playerid] != idcar)
                {
                    return 1;
                }
            }
            if(IsAnOwnableCar(idcar))
            {
                if(PlayerInfo[playerid][pCarkey] == VehicleOwned[idcar]) { }
                else if(PlayerInfo[playerid][pCarkey2] == VehicleOwned[idcar]) { }
                else if(PlayerInfo[playerid][pCarkey3] == VehicleOwned[idcar]) { }
                else { return 1; }
            }
            if(ReduceTime[playerid] > 0)
            {
                format(string, sizeof(string), " You need to wait %d seconds to type this command.", ReduceTime[playerid]);
                SendClientMessage(playerid, COLOR_GREY, string);
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            GiveNameSpace(sendername);
            new engine ,lights, alarm, doors, bonnet, boot, objective;
            new vehicleid = GetPlayerVehicleID(playerid);
            GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
            if(PlayerInfo[playerid][pMaskUse] == 1) { format(sendername, sizeof(sendername), "Stranger_%d", RandMask[playerid]); }
            if (engine == 0)
            {
                format(string, sizeof(string), "* %s spins the %s's key into the ignition and turns on the engine.", sendername, VehicleName[GetVehicleModel(idcar)-400]);
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                new RandomStart;
                RandomStart = random(4);
                switch(RandomStart)
                {
                    case 0,1,2:
                    {
                        if(VehAsk[playerid] == 1)
                        {
                            VehAsk[playerid] = 0;
                            TogglePlayerControllable(playerid,true);
                        }
                        SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
                        format(string, sizeof(string), "* %s engine starts (( %s ))", VehicleName[GetVehicleModel(idcar)-400], sendername);
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    }
                    case 3:
                    {
                        format(string, sizeof(string), "* %s engine does not start (( %s ))", VehicleName[GetVehicleModel(idcar)-400], sendername);
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        ReduceTime[playerid] = 3;
                    }
                }
            }
            else if (engine == 1)
            {
                SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
                format(string, sizeof(string), "* %s spins the %s's key into the ignition and turns the engine off.", sendername, VehicleName[GetVehicleModel(idcar)-400]);
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                VehAsk[playerid] = 1;
            }
        }
        return 1;
    }
Reply
#2

well then the car must be one of these ?

Quote:

if(idcar >= 135 && idcar <= 155)
{
if(HireCar[playerid] != idcar)
{
return 1;
}
}
if(idcar >= 1 && idcar <= 9 || idcar >= 194 && idcar <= 196 || idcar >= 203 && idcar <= 205)
{
if(HireCar[playerid] != idcar)
{
return 1;
}
}

Reply
#3

No, its faction/job/rent checking. It should work in any car? What do you think?
Reply
#4

i think this

RandomStart = random(4);

should be

RandomStart = randomEx(1,4);
Reply
#5

Код:
D:\VERY IMPORTANT STUFF\SA-MP Scripts\EL-RP\gamemodes\el-rp.pwn(39008) : error 017: undefined symbol "randomEx"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#6

try adding this somewhere

Quote:

stock randomEx(minnum = cellmin, maxnum = cellmax) return random(maxnum - minnum + 1) + minnum;

Reply
#7

Compiled, but same problem in-game.
Reply
#8

hmm try changing this

case 0,1,2:

to

if(RandomStart == 0 || RandomStart == 1 || RandomStart == 2)

and

case 3:

to


if(RandomStart == 3)
Reply
#9

Compiler crashed :O :O
Reply
#10

oh lol sorry about that you need to remove

Quote:

switch(RandomStart)
{

for it to work and dont forget to remove } after the if's
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)