[FilterScript] DeliverTruck Job, My First FilterScript
#1

Hey I've just created my first FilterScript.
I'm sure there are alot of warnings and couple errors but I'm begginer and I was wonderd if you can tell me how to fix, what to fix and everything else.
Thank you very much.


Код:
#include <a_samp>

#define COLOR_DARKGOLD 0x808000AA
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA

new TruckerJob[256];

public OnFilterScriptInit()
{
    AddStaticVehicle(403,0,0,0,0,0,0); //Define ur place here
    AddStaticVehicle(403,0,0,0,0,0,0); //Define ur place here
    AddStaticVehicle(403,0,0,0,0,0,0); //Define ur place here
}
forward TruckerJobFinish(playerid);
public TruckerJobFinish(playerid)
{
    if(TruckerJob[playerid] == 0){ return 1; }

    GivePlayerMoney(playerid,200);
    SendClientMessage(playerid,COLOR_YELLOW,"* Well done, the products deliverd to the shop carefully. - $2000");
    TruckerJob[playerid] = 0;

    return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/delivertruck", cmdtext, true, 10) == 0)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 403)
        {
            TruckJob[playerid] = 1;
            new name[MAX_PLAYER_NAME], string[48];
            GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string), "* %s is now Delivering the products.", name );
            SendClientMessageToAll(COLOR_YELLOW, string);
            SendClientMessage(playerid,COLOR_YELLOW,"* Deliver the products through the shop.");
            SetPlayerCheckpoint(i, 0, 0, 0, 3); //Define ur positions
            return 1;
        }
        SendClientMessage(playerid, COLOR_RED,"You have to be in the Truck to start the job");
    }
    return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 403)
     {
         SendClientMessage(playerid, COLOR_RED, "* You can start the deliver by using /delivertruck");
     }
     return 0;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
    if(TruckerJob[playerid] == 1)
    {
        SendClientMessage(playerid, COLOR_RED, "* You have left your job, you won't be payed.");
        TruckerJob[playerid] = 0;
    }
}


public OnPlayerEnterCheckpoint(playerid)
{
	if(GetPVarInt(playerid,"TrackerJob") != 0)
	{
		PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
		DisablePlayerCheckpoint(playerid);
		TruckerJobFinish;
		return 1;
	}
}
Reply
#2

Using STRCMP...when u have alternatives such as ZCMD and YCMD?
Reply
#3

Aight ty
Reply
#4

Hey!
I hope this help you out.

CMD:delivertruck(playerid, params[])
{
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not connetect to use this command.");
if(TruckerJob[playerid] == 1) SendClientMessage(playerid, COLOR_GREY, "You already working");
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 403)
{
TruckJob[playerid] = 1;
new name[MAX_PLAYER_NAME], string[48];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "* %s is now Delivering the products.", name );
SendClientMessageToAll(COLOR_YELLOW, string);
SendClientMessage(playerid,COLOR_YELLOW,"* Deliver the products through the shop.");
SetPlayerCheckpoint(i, 0, 0, 0, 3); //Define ur positions
}
else
{
SendClientMessage(playerid, COLOR_RED,"You have to be in the Truck to start the job");
TruckJob[playerid] = 0;
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)