Vehicle System
#1

Can someone please fix this.

Errors:

Код:
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(131) : error 017: undefined symbol "cmd"
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(134) : error 017: undefined symbol "engine"
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(134) : error 029: invalid expression, assumed zero
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(135) : error 017: undefined symbol "lights"
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(139) : warning 217: loose indentation
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(139) : error 017: undefined symbol "cmd"
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(142) : error 017: undefined symbol "engine"
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(142) : error 029: invalid expression, assumed zero
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(143) : error 017: undefined symbol "lights"
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(147) : warning 217: loose indentation
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(147) : error 017: undefined symbol "cmd"
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(150) : error 017: undefined symbol "engine"
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(150) : error 029: invalid expression, assumed zero
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(151) : error 017: undefined symbol "engine"
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(155) : error 017: undefined symbol "cmd"
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(158) : error 017: undefined symbol "engine"
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(158) : error 029: invalid expression, assumed zero
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(159) : error 017: undefined symbol "engine"
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(165) : warning 217: loose indentation
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(165) : error 017: undefined symbol "cmd"
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(168) : error 017: undefined symbol "engine"
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(169) : error 017: undefined symbol "engine"
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(174) : warning 217: loose indentation
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(174) : error 017: undefined symbol "cmd"
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(177) : error 017: undefined symbol "engine"
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(178) : error 017: undefined symbol "engine"
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(184) : warning 217: loose indentation
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(184) : error 017: undefined symbol "cmd"
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(187) : error 017: undefined symbol "engine"
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(188) : error 017: undefined symbol "engine"
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(193) : warning 217: loose indentation
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(193) : error 017: undefined symbol "cmd"

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


26 Errors.
SCRIPT:

http://pastebin.com/BWKPZ9Kd
Reply
#2

pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT


#include <a_samp>
#include <dini>
#include <dudb>

#pragma unused ret_memcpy
#if defined FILTERSCRIPT
#pragma unused ret_memcpy


#define VEHICLE_PARAMS_UNSET    -1 //This sets if your using the params
#define VEHICLE_PARAMS_OFF  0 //This will set your params OFF
#define VEHICLE_PARAMS_ON   1 //This will set your params ON

native SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
native GetVehicleParamsEx(vehicleid, &engine, &lights, &alarm, &doors, &bonnet, &boot, &objective);

new engine,lights,alarm,doors,bonnet,boot,objective;//This will create the engine/lights,etc varibles

#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA

new fuel[MAX_VEHICLES]; //fuel per vehicle
forward timer_fuel_lower(); //timer for lowering the fuel value
forward timer_refuel(playerid); //timer to refuel vehicle
new isrefuelling[MAX_PLAYERS] = 0; //bool to check if player is already refuelling
new Text:td_fuel[MAX_PLAYERS]; //textdraw with fuel

#define Register 0
#define Logged 1

new Login[MAX_PLAYERS];
new PlayerInfo[MAX_PLAYERS][pInfo];


public OnFilterScriptInit()
{
      for(new i=0;i<MAX_VEHICLES;i++) {
        fuel[i] = 100; //sets every car's fuel to 100 in a loop
    }
    SetTimer("timer_fuel_lower",4200,true); //sets the timer to drop the fuel
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Khaos RolePlay");
    print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("Los Santos");
    ManualVehicleEngineAndLights();
    AddPlayerClass(281,1538.3639,-1673.4520,13.5469,90.6142,0,0,0,0,0,0);
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerConnect(playerid)
{
    return 1;
}


public OnPlayerDisconnect(playerid, reason)
{
    new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    switch(reason)
    {
        case 0: format(string, sizeof(string), "%s has left the server. (Lost Connection)", pname);
        case 1: format(string, sizeof(string), "%s has left the server. (Leaving)", pname);
        case 2: format(string, sizeof(string), "%s has left the server. (Kicked)", pname);
        case 3: format(string, sizeof(string), "%s has left the server. (Banned)", pname);
    }
    SendClientMessageToAll(0xAAAAAAAA, string);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new engine, lights, alarm, doors, bonnet,boot, objective;
    if(strcmp(cmdtext, "/engine",true) == 0)
    {
        if(GetPlayerVehicleID(playerid) != INVALID_VEHICLE_ID)
        {
            GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(GetPlayerVehicleID(playerid),VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
        }
        return 1;
    }
    if(strcmp(cmdtext, "/engineoff",true) == 0)
    {
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID)
        {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
        }
        return 1;
    }
    if(strcmp(cmdtext, "/lights",true) == 0)
    {
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID) {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
        }
        return 1;
    }
    if(strcmp(cmdtext, "/lightsoff",true) == 0)
    {
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID)
        {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);

        }
        return 1;
    }

    if(strcmp(cmdtext, "/turn",true) == 0)
    {
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID)
        {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,VEHICLE_PARAMS_ON);

        }
        return 1;
    }
    if(strcmp(cmdtext, "/turnoff",true) == 0)
    {
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID)
        {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,VEHICLE_PARAMS_OFF);
        }
        return 1;
    }


    if(strcmp(cmdtext, "/opendoors",true) == 0)
    {
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID)
        {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,engine,lights,alarm,VEHICLE_PARAMS_ON,bonnet,boot,objective);

        }
        return 1;
    }
    if(strcmp(cmdtext, "/closedoors",true) == 0)
    {
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID)
        {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,engine,lights,alarm,VEHICLE_PARAMS_OFF,bonnet,boot,objective);
        }
        return 1;
    }

    if(strcmp(cmdtext, "/alarmon",true) == 0)
    {
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID) {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective);

        }
        return 1;
    }
    if(strcmp(cmdtext, "/alarmoff",true) == 0)
    {
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID)
        {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,engine,lights,VEHICLE_PARAMS_OFF,doors,bonnet,boot,objective);
        }
        return 1;
    }

    if(strcmp(cmdtext, "/openbonnet",true) == 0)
    {
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID)
        {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,boot,objective);

        }
        return 1;
    }
    if(strcmp(cmdtext, "/closebonnet",true) == 0)
    {
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID)
        {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,engine,lights,alarm,doors,VEHICLE_PARAMS_OFF,boot,objective);
        }
        return 1;
    }

    if(strcmp(cmdtext, "/openboot",true) == 0)
    {
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID)
        {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective);

        }
        return 1;
    }
    if(strcmp(cmdtext, "/closeboot",true) == 0)
    {
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID)
        {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_OFF,objective);
        }
        return 1;
    }
    if (!strcmp("/fill",cmdtext,true,7))
    {
        if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFFC800FF,"You are not in an vehicle!"); //if a player isnt in a vehicle, it stops here
        if (GetPlayerMoney(playerid) - 80 <0) return SendClientMessage(playerid,0xFFC800FF,"You dont have enough money!"); //if a player doesnt have $80 anymore, it stops here
        GivePlayerMoney(playerid,-80); //Sets the player's cash -$80
        SetCameraBehindPlayer(playerid); //Sets the camera behind the player (looks better because the player will be frozen for a few secs)
        TogglePlayerControllable(playerid,0); //freezes the player so he cant drive and refuel at the same time
//        TextDrawSetString(td_fuel[playerid],"Refuelling..."); //changing textdraw to /refuel
        SetTimerEx("timer_refuel",4500,false,"i",playerid); //setting refueltimer
        return 1;
    }
    return 0;
}

public timer_fuel_lower()
{
    for(new i=0;i<MAX_PLAYERS;i++) { //loop for all players
        if (isrefuelling[i]) continue; //stop when a player is already refuelling
        new vid = GetPlayerVehicleID(i); //getting vehicle ID
        if (GetPlayerVehicleSeat(i) == 0) { //if the player is a driver (it should only lower the fuel when theres an driver!)
            fuel[vid] = fuel[vid] -1; //lowering fuel value
            if (fuel[vid]<1) //if fuel is empty
            {
                fuel[vid] = 0; //setting fuel to 0 (else the timer will set it to -1 -2 -3 etc before removing player)
                RemovePlayerFromVehicle(i); //remove player out of vehicle
                GameTextForPlayer(i,"~r~You are out of ~w~fuel~r~!",5000,4); //show text
            }
        }
        new string[125];format(string,sizeof string,"Fuel:%i",fuel[vid]); //preparing string with next fuel value
        TextDrawSetString(td_fuel[i],string); //updating textdraw
    }
    return 1;
}

public timer_refuel(playerid)
{
    new vid = GetPlayerVehicleID(playerid);
    fuel[vid] = fuel[vid] = 100; //restoring fuel to 100
    isrefuelling[playerid] = 0;//resetting anti-spam thingy :3
    TextDrawSetString(td_fuel[playerid],"Fuel:100"); //small update on textdraw
    TogglePlayerControllable(playerid,1); //unfreeze player
}

 
 
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

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

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1538.3639, -1673.4520, 13.5469);
    SetPlayerCameraPos(playerid, 1538.3639, -1673.4520, 13.5469);
    SetPlayerCameraLookAt(playerid, 1538.3639, -1673.4520, 13.5469);
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{

}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
....

....
Reply
#3

Now i get:

Код:
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(294) : warning 235: public function lacks forward declaration (symbol "timer_fuel_lower")
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(297) : error 017: undefined symbol "isrefuelling"
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(297) : warning 215: expression has no effect
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(297) : error 001: expected token: ";", but found "]"
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(297) : error 029: invalid expression, assumed zero
C:\GTA Trucking Server\Test Script Server\gamemodes\khaos.pwn(297) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)