Trucking script Help
#9

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

#include <a_samp>

#if defined FILTERSCRIPT

#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define CAR_TYPE_LOGGING 422

new gCarData[MAX_VEHICLES] = { INVALID_VEHICLE_ID, ... };

public OnFilterScriptInit()
{

    AddDynamicCar(422,1595.3313,-1709.8433,5.6725,180.4009,16,1, 3600, CAR_TYPE_LOGGING );
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;

}

stock AddDynamicCar(modelid, Float:cx, Float:cy, Float:cz, Float:cfa, color1, color2, respawndelay, cartype)
{
    new vindex = CreateVehicle(modelid, cx, cy, cz, cfa, color1, color2, respawndelay);
    if(vindex != INVALID_VEHICLE_ID)
    {
        gCarData[vindex] = cartype;
        return vindex;
    }
    return INVALID_VEHICLE_ID;
}


enum cInfo
{
    logs
};

new CarInfo[1][cInfo];


public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

#endif



public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

stock IsALogging(carid)
{
    if(gCarData[carid] == CAR_TYPE_LOGGING) return 1;
    return 0;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/loadlogs", cmdtext, true, 10) == 0)
    {
        if(GetPlayerScore(playerid) >= -500)
        {
            if(IsPlayerInRangeOfPoint(playerid, 7.0, -1969.5801, -2431.8479, 30.6250))
            {
                new vehid = GetPlayerVehicleID(playerid);
                if(IsALogging(vehid))
                {
                    if(CarInfo[IsALogging(vehid)][logs] == 0)
                    {
                        CarInfo[IsALogging(vehid)][logs] = 1;
                        GivePlayerMoney(playerid, -3000);
                        SendClientMessage(playerid, COLOR_GREEN, "You loaded full truck of logs, and paid  $3000 for it! Head to unload place!");
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_RED, "Your truck is already loaded!");
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "You're not in truck, that can deliver logs!");
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "You cannot load your truck here!");
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "Your job isn't trucker!");
        }
        return 1;
    }
    if (strcmp("/unloadlogs", cmdtext, true, 10) == 0)
    {
        if(GetPlayerScore(playerid) >= -500)
        {
            if(IsPlayerInRangeOfPoint(playerid, 7.0, 2334.8611, -2081.3384, 13.5469))
            {
                new Vehid = GetPlayerVehicleID(playerid);
                if(Vehid == 422)
                {
                    if(CarInfo[Vehid] [logs] == 1)
                    {
                        CarInfo[Vehid][logs] = 0;
                        new cash = random(30000);
                        GivePlayerMoney(playerid, cash);
                        new string[128];
                        format(string,sizeof(string),"You earned %d$ from the delivery",cash);
                        SendClientMessage(playerid,COLOR_GREEN,string);

                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_RED, "Your truck is empety!");
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "You are not in a truck, that can deliver logs!");
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "You cannot unload your truck here!");
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "You are not a trucker!");
        }
        return 1;
    }
   
    if (strcmp("/frisktruck", cmdtext, true, 10) == 0)
    {
        if(GetPlayerScore(playerid) >= -500)
        {
            new vehicleid1 = GetPlayerVehicleID(playerid);
            if(vehicleid1 == 422)
            {
                if(CarInfo[vehicleid1][logs] == 1)
                {
                    if(CarInfo[vehicleid1][logs] == 0)
                    {
                        SendClientMessage(playerid, COLOR_GREEN, "Logs not loaded.");
                    }
                    else if(CarInfo[vehicleid1][logs] == 1)
                    {
                        SendClientMessage(playerid, COLOR_GREEN, "Logs loaded.");
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "This truck cannot deliver logs!");
            }
        }
        else
        {
                SendClientMessage(playerid, COLOR_RED, "You cannot use this command!");
        }
    }
    return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}
It doesn't give out any errors but it still says "You're not in truck, that can deliver logs!"
Also I know, I didn't apply anything for /frisktruck and /unloadlogs yet but I will if I get fix for /loadiron
Reply


Messages In This Thread
Trucking script Help - by Zigonja - 31.05.2013, 17:38
Re: Trucking script Help - by mahdi499 - 31.05.2013, 17:42
Re: Trucking script Help - by Zigonja - 31.05.2013, 17:46
Re: Trucking script Help - by mahdi499 - 31.05.2013, 17:47
Re: Trucking script Help - by Pottus - 31.05.2013, 17:48
Re: Trucking script Help - by Zigonja - 31.05.2013, 17:50
Re: Trucking script Help - by Pottus - 31.05.2013, 17:52
Re: Trucking script Help - by Zigonja - 31.05.2013, 17:55
Re: Trucking script Help - by Zigonja - 31.05.2013, 18:53
Re: Trucking script Help - by Zigonja - 31.05.2013, 21:37

Forum Jump:


Users browsing this thread: 1 Guest(s)