Engine off/on with keys help
#1

Hi , i need some help with this code here :

pawn Код:
if(newkeys & KEY_JUMP)
    {
        new engine,lights,alarm,doors,bonnet,boot,objective;
        new vehid = GetPlayerVehicleID(playerid);
        if(GetPlayerState(playerid)==PLAYER_STATE_DRIVER)
        {
            if(vehid == 481 || vehid == 509 || vehid == 510)
                return 1;
            GetVehicleParamsEx(vehid,engine,lights,alarm,doors,bonnet,boot,objective);
            if(engine<=0)
            {
                GameTextForPlayer(playerid, "~g~Starting the engine...", 1200, 1);
                SetTimerEx("StartEngine", 3000, 0, "ii", playerid, vehid);
            }
            else if(engine<=1)
            {
                GameTextForPlayer(playerid, "~r~Stopping the engine...", 1200, 1);
                SetTimerEx("StopEngine", 3000, 0, "ii", playerid, vehid);
            }
        }
    }
I get some warnings , but i don't know from what they come out .

Код:
D:\Downloads\Trucking_Server_2.0\gamemodes\SERVER.pwn(15254) : warning 219: local variable "engine" shadows a variable at a preceding level
D:\Downloads\Trucking_Server_2.0\gamemodes\SERVER.pwn(15254) : warning 219: local variable "lights" shadows a variable at a preceding level
D:\Downloads\Trucking_Server_2.0\gamemodes\SERVER.pwn(15254) : warning 219: local variable "alarm" shadows a variable at a preceding level
D:\Downloads\Trucking_Server_2.0\gamemodes\SERVER.pwn(15254) : warning 219: local variable "doors" shadows a variable at a preceding level
D:\Downloads\Trucking_Server_2.0\gamemodes\SERVER.pwn(15254) : warning 219: local variable "bonnet" shadows a variable at a preceding level
D:\Downloads\Trucking_Server_2.0\gamemodes\SERVER.pwn(15254) : warning 219: local variable "boot" shadows a variable at a preceding level
D:\Downloads\Trucking_Server_2.0\gamemodes\SERVER.pwn(15254) : warning 219: local variable "objective" shadows a variable at a preceding level
D:\Downloads\Trucking_Server_2.0\gamemodes\SERVER.pwn(15255) : warning 219: local variable "vehid" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


8 Warnings.
I wanna fix these warnings , help please .

REP+

Thanks in advance
Reply
#2

pawn Код:
if(newkeys & KEY_JUMP)
    {
        vehid = GetPlayerVehicleID(playerid);
        if(GetPlayerState(playerid)==PLAYER_STATE_DRIVER)
        {
            if(vehid == 481 || vehid == 509 || vehid == 510)
                return 1;
            GetVehicleParamsEx(vehid,engine,lights,alarm,doors,bonnet,boot,objective);
            if(engine<=0)
            {
                GameTextForPlayer(playerid, "~g~Starting the engine...", 1200, 1);
                SetTimerEx("StartEngine", 3000, 0, "ii", playerid, vehid);
            }
            else if(engine<=1)
            {
                GameTextForPlayer(playerid, "~r~Stopping the engine...", 1200, 1);
                SetTimerEx("StopEngine", 3000, 0, "ii", playerid, vehid);
            }
        }
    }
Reply
#3

Delete new engine,lights,alarm,doors,bonnet,boot,objective; on line 15254
and delete new vehid = GetPlayerVehicleID(playerid); on line 15255.
Reply
#4

Quote:
Originally Posted by Boooth
Посмотреть сообщение
pawn Код:
if(newkeys & KEY_JUMP)
    {
        vehid = GetPlayerVehicleID(playerid);
        if(GetPlayerState(playerid)==PLAYER_STATE_DRIVER)
        {
            if(vehid == 481 || vehid == 509 || vehid == 510)
                return 1;
            GetVehicleParamsEx(vehid,engine,lights,alarm,doors,bonnet,boot,objective);
            if(engine<=0)
            {
                GameTextForPlayer(playerid, "~g~Starting the engine...", 1200, 1);
                SetTimerEx("StartEngine", 3000, 0, "ii", playerid, vehid);
            }
            else if(engine<=1)
            {
                GameTextForPlayer(playerid, "~r~Stopping the engine...", 1200, 1);
                SetTimerEx("StopEngine", 3000, 0, "ii", playerid, vehid);
            }
        }
    }
Код:
D:\Downloads\Trucking_Server_2.0\gamemodes\SERVER.pwn(15254) : error 033: array must be indexed (variable "vehid")
D:\Downloads\Trucking_Server_2.0\gamemodes\SERVER.pwn(15257) : error 033: array must be indexed (variable "vehid")
D:\Downloads\Trucking_Server_2.0\gamemodes\SERVER.pwn(15259) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Quote:
Originally Posted by jakejohnsonusa
Посмотреть сообщение
Delete new engine,lights,alarm,doors,bonnet,boot,objective; on line 15254
and delete new vehid = GetPlayerVehicleID(playerid); on line 15255.
Wait a min i try it and i edit this message

EDIT :
Код:
D:\Downloads\Trucking_Server_2.0\gamemodes\SERVER.pwn(15256) : error 033: array must be indexed (variable "vehid")
D:\Downloads\Trucking_Server_2.0\gamemodes\SERVER.pwn(15258) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
This happens with your code .
Reply
#5

bump - Any solutions please ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)