Errors
#1

Once again some admin removed my topic -.-

I'm trying to add a engine system but I get some errors.
I've tried to fix it but can't do it.

Код:
C:\Users\***Documents\GT Testing\gamemodes\GranTrucking.pwn(2195) : error 021: symbol already defined: "OnPlayerExitVehicle"
C:\Users\***\Documents\GT Testing\gamemodes\GranTrucking.pwn(2090) : error 021: symbol already defined: "OnPlayerStateChange"
C:\Users\***\Documents\GT Testing\gamemodes\GranTrucking.pwn(2110) : error 021: symbol already defined: "OnPlayerKeyStateChange"
pawn Код:
forward StartEngine(playerid);
forward DamagedEngine(playerid);
new vehEngine[MAX_VEHICLES];

public OnPlayerStateChange(playerid, newstate, oldstate)
{
        new vehicleid = GetPlayerVehicleID(playerid);
        if(newstate == PLAYER_STATE_DRIVER)
        {
            if(vehEngine[vehicleid] == 0)
            {
                TogglePlayerControllable(playerid, 0);
                SendClientMessage(playerid, 0xFF0000, "{FFFFFF}Your engine is {FF0000}OFF");
                SendClientMessage(playerid, 0xFF0000, "{FFFFFF}Press Shift to {00FF00}start {FFFFFF}your engine");
                }
                else if(vehEngine[vehicleid] == 1)
                {
                    TogglePlayerControllable(playerid, 1);
                    SendClientMessage(playerid, 0xFF0000, "{FF0000}Engine {00FF00}ON");
                }
        }
        return 1;
}

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, 0xFF0000, "{00FF00}Starting {FFFFFF}engine");
                        }
                }
                if(newkeys == KEY_SECONDARY_ATTACK)
                {
                    RemovePlayerFromVehicle(playerid);
                    TogglePlayerControllable(playerid, 1);
                }
        }
        return 1;
}

public StartEngine(playerid)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    new Float:health;
    new rand = random(2);
    GetVehicleHealth(vehicleid, health);
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(vehEngine[vehicleid] == 2)
            {
                if(health > 300)
                        {
                            if(rand == 0)
                            {
                                        vehEngine[vehicleid] = 1;
                                        TogglePlayerControllable(playerid, 1);
                                        SetTimerEx("DamagedEngine", 1000, 1, "i", playerid);
                                SendClientMessage(playerid, 0xFF0000, "{FFFFFF}Your engine {00FF00}started!");
                                }
                                if(rand == 1)
                                {
                                    vehEngine[vehicleid] = 0;
                                    TogglePlayerControllable(playerid, 0);
                                    SendClientMessage(playerid, 0xFF0000, "{FFFFFF}You {FF0000}failed {FFFFFF}to start the engine!");
                                }
                        }
                        else
                        {
                            vehEngine[vehicleid] = 0;
                            TogglePlayerControllable(playerid, 0);
                            SendClientMessage(playerid, 0xFF0000, "{FFFFFF}Your vehicle {FF0000}failed {FFFFFF}to start! - {FF0000}Reason: {FFFFFF}To much damage!");
                        }
                }
        }
        return 1;
}



public DamagedEngine(playerid)
{

    new vehicleid = GetPlayerVehicleID(playerid);
    new Float:health;
    GetVehicleHealth(vehicleid, health);
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(vehEngine[vehicleid] == 1)
            {
                if(health < 300)
                        {
                            vehEngine[vehicleid] = 0;
                                TogglePlayerControllable(playerid, 0);
                            SendClientMessage(playerid, 0xFF0000, "{FFFFFF}Engine {FF0000}OFF - {FF0000}Reason: {FFFFFF}- To much damage!");
                        }
                }
        }
        return 1;
}



public OnPlayerExitVehicle(playerid, vehicleid)
{
        TogglePlayerControllable(playerid, 1);
        return 1;

}
Reply
#2

Are u using a include that uses those callbacks?
Reply
#3

Yes I am.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)