Role Play problem.
#1

My problem is that when i turn the car engine writing command /engine then i leave car and the engine stay turned on i enter to the another car and write the /engine and the command don't work, the car engine doesn't start up, and when i turn of the first cars engine and again go to the next then it work.. So can somone help me? here is Gamemod Download link... http://www.megaupload.com/?d=VN2CAZUY
Reply
#2

Try this:

Put this on top
pawn Code:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
This in OnPlayerCommandText
pawn Code:
dcmd(engine, 6, cmdtext);
And finally, somewhere where you want:
pawn Code:
dcmd_engine(playerid, params[])
{
    #pragma unused params
    if(IsPlayerInAnyVehicle(playerid))
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new vehicleid = GetPlayerVehicleID(playerid);
            GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
            if(engine == 1)
            {
                SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
                SendClientMessage(playerid, COLOR_WHITE, "The vehicle's engine stopped succesfully.");
            }
            else
            {
                SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
                SendClientMessage(playerid, COLOR_WHITE, "The vehicle's engine started succesfully.");
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "You are not at the driver's seat!");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "You are not in a vehicle!");
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by Hipflop
View Post
Try this:

Put this on top
pawn Code:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
This in OnPlayerCommandText
pawn Code:
dcmd(engine, 6, cmdtext);
And finally, somewhere where you want:
pawn Code:
dcmd_engine(playerid, params[])


{
    #pragma unused params
    if(IsPlayerInAnyVehicle(playerid))
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new vehicleid = GetPlayerVehicleID(playerid);
            GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
            if(engine == 1)
            {
                SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
                SendClientMessage(playerid, COLOR_WHITE, "The vehicle's engine stopped succesfully.");
            }
            else
            {
                SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
                SendClientMessage(playerid, COLOR_WHITE, "The vehicle's engine started succesfully.");
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "You are not at the driver's seat!");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "You are not in a vehicle!");
    }
    return 1;
}
His command work. He asked to fix his problem not to give him your command.

OnTopic: Problem is probably in returning function.
Reply
#4

Quote:
Originally Posted by [MG]Dimi
View Post
His command work. He asked to fix his problem not to give him your command.

OnTopic: Problem is probably in returning function.
If there is a problem in his command, it doesn't work....
I just help him with giving my code, so that he can look what the problem he have.
Reply
#5

Quote:
Originally Posted by Hipflop
View Post
Try this:

Put this on top
pawn Code:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
This in OnPlayerCommandText
pawn Code:
dcmd(engine, 6, cmdtext);
And finally, somewhere where you want:
pawn Code:
dcmd_engine(playerid, params[])
{
    #pragma unused params
    if(IsPlayerInAnyVehicle(playerid))
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new vehicleid = GetPlayerVehicleID(playerid);
            GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
            if(engine == 1)
            {
                SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
                SendClientMessage(playerid, COLOR_WHITE, "The vehicle's engine stopped succesfully.");
            }
            else
            {
                SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
                SendClientMessage(playerid, COLOR_WHITE, "The vehicle's engine started succesfully.");
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "You are not at the driver's seat!");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "You are not in a vehicle!");
    }
    return 1;
}
Can you look my gammode and fix thath probl plz? Myb that problem is beacuse i can start the engine with SHIFT button
Reply
#6

I'll take a look.

EDIT: Now it should work.
Find OnPlayerKeyStateChange, and replace Line 49460 to 49532 with:

pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    new string[128];
    new sendername[MAX_PLAYER_NAME];
    new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
    new newcar = GetPlayerVehicleID(playerid);
    if(newkeys == KEY_JUMP)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerInAnyVehicle(i))
            {
                if(IsPlayerConnected(i))
                {
                    if(!engineOn[GetPlayerVehicleID(i)])
                    {
                        if(GetPlayerState(i) == PLAYER_STATE_PASSENGER)
                        {
                            return 1;
                        }
                        if(IsAnOwnableCar(newcar))
                        {
                            if(PlayerInfo[playerid][pPcarkey] == newcar) { }
                            else if(PlayerInfo[playerid][pPcarkey2] == newcar) { }
                            else if(PlayerInfo[playerid][pPcarkey3] == newcar) { }
                            else if(PlayerInfo[playerid][pDublicateKey1] == newcar) { }
                            else if(PlayerInfo[playerid][pDublicateKey2] == newcar) { }
                            else { return 1; }
                        }
                        if(pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509)
                        {
                            return 1;
                        }
                        if(newcar == 59 || newcar == 60)
                        {
                            return 1;
                        }
                        if(newcar >= 135 && newcar <= 154)
                        {
                            if(HireCar[playerid] != newcar)
                            {
                                return 1;
                            }
                        }
                        if(IsAHarvest(newcar))
                        {
                            return 1;
                        }
                        if(IsADrugHarvest(newcar))
                        {
                            return 1;
                        }
                        if(IsASweeper(newcar))
                        {
                            return 1;
                        }
                        if(gEngine[playerid] == 1) { return 1; }

    //                    new playerveh = GetPlayerVehicleID(playerid);
                        PutPlayerInVehicle(playerid, newcar, 0);
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        sendername[strfind(sendername, "_")] = ' ';
                        format(string, sizeof(string), "* %s pagrieю atslзgu un mзмina pielaist maроnas motoru.", sendername);
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        SetTimerEx("StartingTheVehicle",3500,0,"i",playerid);
                        GameTextForPlayer(playerid, "~w~Iedarbina motoru...",3500,3);
                        gEngine[playerid] = 1;
                    return 1;
                    }
                }
            }
        }
    }
Reply
#7

Quote:
Originally Posted by Hipflop
View Post
I'll take a look.

EDIT: Now it should work.
Find OnPlayerKeyStateChange, and replace Line 49460 to 49532 with:

pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    new string[128];
    new sendername[MAX_PLAYER_NAME];
    new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
    new newcar = GetPlayerVehicleID(playerid);
    if(newkeys == KEY_JUMP)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerInAnyVehicle(i))
            {
                if(IsPlayerConnected(i))
                {
                    if(!engineOn[GetPlayerVehicleID(i)])
                    {
                        if(GetPlayerState(i) == PLAYER_STATE_PASSENGER)
                        {
                            return 1;
                        }
                        if(IsAnOwnableCar(newcar))
                        {
                            if(PlayerInfo[playerid][pPcarkey] == newcar) { }
                            else if(PlayerInfo[playerid][pPcarkey2] == newcar) { }
                            else if(PlayerInfo[playerid][pPcarkey3] == newcar) { }
                            else if(PlayerInfo[playerid][pDublicateKey1] == newcar) { }
                            else if(PlayerInfo[playerid][pDublicateKey2] == newcar) { }
                            else { return 1; }
                        }
                        if(pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509)
                        {
                            return 1;
                        }
                        if(newcar == 59 || newcar == 60)
                        {
                            return 1;
                        }
                        if(newcar >= 135 && newcar <= 154)
                        {
                            if(HireCar[playerid] != newcar)
                            {
                                return 1;
                            }
                        }
                        if(IsAHarvest(newcar))
                        {
                            return 1;
                        }
                        if(IsADrugHarvest(newcar))
                        {
                            return 1;
                        }
                        if(IsASweeper(newcar))
                        {
                            return 1;
                        }
                        if(gEngine[playerid] == 1) { return 1; }

    //                    new playerveh = GetPlayerVehicleID(playerid);
                        PutPlayerInVehicle(playerid, newcar, 0);
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        sendername[strfind(sendername, "_")] = ' ';
                        format(string, sizeof(string), "* %s pagrieю atslзgu un mзмina pielaist maроnas motoru.", sendername);
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        SetTimerEx("StartingTheVehicle",3500,0,"i",playerid);
                        GameTextForPlayer(playerid, "~w~Iedarbina motoru...",3500,3);
                        gEngine[playerid] = 1;
                    return 1;
                    }
                }
            }
        }
    }
Still dont understan it... Dont work,....
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)