SA-MP Forums Archive
annoyed - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: annoyed (/showthread.php?tid=455013)



annoyed - Jhony_Blaze - 31.07.2013

I am trying to make this taxi system to work as a filterscript, but I keep failing, I am sure that I am doing something wrong I am a newbie scripter, I got the script from somebody, but I can't get it work, here is the script:

Код:
#define FILTERSCRIPT

#include <a_samp>
#include <zcmd>

#define MAX_JOBS 1
#define JOB_NONE 0
#define JOB-TAXI 1

enum pInfo
{
	pMember
	pLeader
	pJob
	pJob2
	pTaxiLicense
};

CMD:fare(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] == 10||PlayerInfo[playerid][pLeader] == 10|| PlayerInfo[playerid][pJob] == 17 || PlayerInfo[playerid][pJob2] == 17 || PlayerInfo[playerid][pTaxiLicense] == 1)
	{
		new string[128], fare;
		if(sscanf(params, "d", fare)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /fare [price]");

		if(TransportDuty[playerid] > 0)
		{
			if(TransportDuty[playerid] == 1)
			{
				TaxiDrivers -= 1;
			}
			else if(TransportDuty[playerid] == 2)
			{
				BusDrivers -= 1;
			}
			TransportDuty[playerid] = 0;
			format(string, sizeof(string), "* You are now off duty and earned $%d.", TransportMoney[playerid]);
			SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
			GivePlayerCash(playerid, TransportMoney[playerid]);
			ConsumingMoney[playerid] = 1; TransportValue[playerid] = 0; TransportMoney[playerid] = 0;
			SetPlayerToTeamColor(playerid);
			return 1;
		}
		if(JobDuty[playerid] != 0) return SendClientMessageEx(playerid,COLOR_GREY," You need to get off duty with your mechanic/lawyer job first.");
		new newcar = GetPlayerVehicleID(playerid);
		if(IsAnTaxi(newcar))
		{
			if(GetPlayerState(playerid) == 2 && PlayerInfo[playerid][pJob] == 17 || PlayerInfo[playerid][pJob2] == 17)
			{
				if(fare < 1 || fare > 500)
				{
					SendClientMessageEx(playerid, COLOR_GREY, "   Fare price must be between $1 and $500!");
					return 1;
				}
				TaxiDrivers += 1; TransportDuty[playerid] = 1; TransportValue[playerid] = fare;
				format(string, sizeof(string), "You are now on-duty as Taxi Driver, fare: $%d.", TransportValue[playerid]);
				SendClientMessageEx(playerid, COLOR_WHITE, string);
				SetPlayerToTeamColor(playerid);
			}
			else
			{
				SendClientMessageEx(playerid, COLOR_GREY, "   You are not the taxi driver!");
				return 1;
}

These are the errors:

Код:
C:\Documents and Settings\Administrator\Desktop\taxi.pwn(13) : error 001: expected token: "}", but found "-identifier-"
C:\Documents and Settings\Administrator\Desktop\taxi.pwn(17) : error 010: invalid function or declaration
C:\Documents and Settings\Administrator\Desktop\taxi.pwn(21) : error 017: undefined symbol "PlayerInfo"
C:\Documents and Settings\Administrator\Desktop\taxi.pwn(21) : warning 215: expression has no effect
C:\Documents and Settings\Administrator\Desktop\taxi.pwn(21) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Administrator\Desktop\taxi.pwn(21) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\Desktop\taxi.pwn(21) : fatal error 107: too many error messages on one line

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


6 Errors.
If someone could help me I would really appreciate it, thank you very much !!!


Re: annoyed - Facerafter - 31.07.2013

Allright first of all change
pawn Код:
enum pInfo
{
    pMember
    pLeader
    pJob
    pJob2
    pTaxiLicense
};
To
pawn Код:
enum pInfo
{
    pMember,
    pLeader,
    pJob,
    pJob2,
    pTaxiLicense
}
new PlayerInfo[MAX_PLAYERS][pInfo];



Re: annoyed - JimmyCh - 31.07.2013

You actually need to add it in your gamemode, would be better.
I tried fixing some errors but I can't remove them all.
Check this:
pawn Код:
#define FILTERSCRIPT

#include <a_samp>
#include <zcmd>
#include <sscanf2>

#define MAX_JOBS 1
#define JOB_NONE 0
#define JOB-TAXI 1
#define COLOR_WHITE 0xFFFFFFFF

enum pInfo
{
    pMember,
    pLeader,
    pJob,
    pJob2,
    pTaxiLicense,
};

new PlayerInfo[MAX_PLAYERS][pInfo];
new TransportDuty;

CMD:fare(playerid, params[])
{
    if(PlayerInfo[playerid][pMember] == 10||PlayerInfo[playerid][pLeader] == 10|| PlayerInfo[playerid][pJob] == 17 || PlayerInfo[playerid][pJob2] == 17 || PlayerInfo[playerid][pTaxiLicense] == 1)
    {
        new string[128], fare;
        if(sscanf(params, "d", fare)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /fare [price]");

        if(TransportDuty[playerid] >= 0)
        {
            TaxiDrivers -= 1;
        }
        else if(TransportDuty[playerid] == 2)
        {
            BusDrivers -= 1;
        }
        TransportDuty[playerid] = 0;
        format(string, sizeof(string), "* You are now off duty and earned $%d.", TransportMoney[playerid]);
        SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
        GivePlayerCash(playerid, TransportMoney[playerid]);
        ConsumingMoney[playerid] = 1; TransportValue[playerid] = 0; TransportMoney[playerid] = 0;
        SetPlayerToTeamColor(playerid);
        return 1;
        if(JobDuty[playerid] != 0) return SendClientMessageEx(playerid,COLOR_GREY," You need to get off duty with your mechanic/lawyer job first.");
        new newcar = GetPlayerVehicleID(playerid);
        if(IsAnTaxi(newcar))
        {
            if(GetPlayerState(playerid) == 2 && PlayerInfo[playerid][pJob] == 17 || PlayerInfo[playerid][pJob2] == 17)
            {
                if(fare < 1 || fare > 500)
                {
                    SendClientMessageEx(playerid, COLOR_GREY, "   Fare price must be between $1 and $500!");
                    return 1;
                }
                TaxiDrivers += 1; TransportDuty[playerid] = 1; TransportValue[playerid] = fare;
                format(string, sizeof(string), "You are now on-duty as Taxi Driver, fare: $%d.", TransportValue[playerid]);
                SendClientMessageEx(playerid, COLOR_WHITE, string);
                SetPlayerToTeamColor(playerid);
            }
            else
            {
                SendClientMessageEx(playerid, COLOR_GREY, "   You are not the taxi driver!");
                return 1;

            }
        }
    }
    return 1;
}



Re: annoyed - Jhony_Blaze - 31.07.2013

Thanks, but I still get error on line 31,errors :

Код:
C:\Documents and Settings\Administrator\Desktop\taxi.pwn(31) : error 028: invalid subscript (not an array or too many subscripts): "TransportDuty"
C:\Documents and Settings\Administrator\Desktop\taxi.pwn(31) : warning 215: expression has no effect
C:\Documents and Settings\Administrator\Desktop\taxi.pwn(31) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Administrator\Desktop\taxi.pwn(31) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\Desktop\taxi.pwn(31) : fatal error 107: too many error messages on one line

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


4 Errors.
This is the line of errors:

Код:
    if(TransportDuty[playerid] >= 0)