[Tutorial] Team Cars and Team Players
#15

Quote:
Originally Posted by nexco
View Post
I got the same errorS!! Please somebody can help me here? ='(

Code:
C:\Documents and Settings\Tiago Esteves\Ambiente de trabalho\Servidor - Teste\pawno\Driftv2.pwn(14) : error 001: expected token: "-identifier-", but found "-integer value-"
C:\Documents and Settings\Tiago Esteves\Ambiente de trabalho\Servidor - Teste\pawno\Driftv2.pwn(47) : warning 213: tag mismatch
C:\Documents and Settings\Tiago Esteves\Ambiente de trabalho\Servidor - Teste\pawno\Driftv2.pwn(47) : error 032: array index out of bounds (variable "Cars")
C:\Documents and Settings\Tiago Esteves\Ambiente de trabalho\Servidor - Teste\pawno\Driftv2.pwn(48) : warning 213: tag mismatch
C:\Documents and Settings\Tiago Esteves\Ambiente de trabalho\Servidor - Teste\pawno\Driftv2.pwn(48) : error 032: array index out of bounds (variable "Cars")
C:\Documents and Settings\Tiago Esteves\Ambiente de trabalho\Servidor - Teste\pawno\Driftv2.pwn(49) : warning 213: tag mismatch
C:\Documents and Settings\Tiago Esteves\Ambiente de trabalho\Servidor - Teste\pawno\Driftv2.pwn(49) : error 032: array index out of bounds (variable "Cars")
C:\Documents and Settings\Tiago Esteves\Ambiente de trabalho\Servidor - Teste\pawno\Driftv2.pwn(50) : warning 213: tag mismatch
C:\Documents and Settings\Tiago Esteves\Ambiente de trabalho\Servidor - Teste\pawno\Driftv2.pwn(50) : error 032: array index out of bounds (variable "Cars")
C:\Documents and Settings\Tiago Esteves\Ambiente de trabalho\Servidor - Teste\pawno\Driftv2.pwn(702) : warning 213: tag mismatch
C:\Documents and Settings\Tiago Esteves\Ambiente de trabalho\Servidor - Teste\pawno\Driftv2.pwn(702) : error 032: array index out of bounds (variable "Cars")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


6 Errors.
Here's the script:

Code:
#include <a_samp>
#include <core>

#define SPECIAL_ACTION_PISSING 68
#define MAX_INVALID_NOS_VEHICLES 29
#define DOD 1
#define DOD_COLOUR 0x00820FAA
#define COLOR_RED 0xFF0000AA



enum TeamCars
{
DOD
}

new Cars[TeamCars];
new gTeam[MAX_PLAYERS];
new ELEGY;
new ELEGY2;
new ELEGY3;
new JESTER;
new JESTER2;
new STRATUM;
new STRATUM2;
new STRATUM3;
new STRATUM4;
new TE1;

forward NitroReset();

main()
{
	print("\n __________________________________\n");
	print("\n|                      Drift                           |\n");
	print("\n|__________________________________|\n");
}

public OnGameModeInit()
{
	SetGameModeText("Drift");
	UsePlayerPedAnims();
	SetTimer("NitroReset", 1500, 1);
	//Funзхes para Spawn de Members - DOD
 	AddPlayerClass(299,2497.2693,-1676.9578,13.3398,23.6501,0,0,0,0,0,0);
    AddPlayerClass(104,1544.0514,-1675.7766,13.5577,98.0974,0,0,0,0,0,0); 
    Cars[DOD] = CreateVehicle(562,-2506.870117, -635.783325, 134.652481, 359.465423, -1, -1, 10000);
    Cars[DOD] = CreateVehicle(429,-2494.236083, -633.563049, 134.012542, 359.016265, -1, -1, 10000);
    Cars[DOD] = CreateVehicle(507,-2530.7561,-618.6442,132.1928,269.1777,1,1);
    Cars[DOD] = CreateVehicle(436,-2529.5754,-606.6457,132.1944,270.8741,1,1);
    return 1;
}
public OnGameModeExit()
{
	return 1;
}

public OnPlayerUpdate(playerid)
{
    SetPlayerScore(playerid, GetPlayerMoney(playerid));
    return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerTeamFromClass(playerid, classid);
    return 1;
}

public NitroReset()
{
	for(new i = 0; i<MAX_PLAYERS; i++)
	{
	    if(!IsPlayerInInvalidNosVehicle(i,GetPlayerVehicleID(i)))
		{
    		    new vehicle = GetPlayerVehicleID(i);
                AddVehicleComponent(vehicle, 1010);
		}
	}
}

IsPlayerInInvalidNosVehicle(playerid,vehicleid)
{
   

    new InvalidNosVehicles[MAX_INVALID_NOS_VEHICLES] =
    {
	581,523,462,521,463,522,461,448,468,586,
	509,481,510,472,473,493,595,484,430,453,
	452,446,454,590,569,537,538,570,449
    };

    vehicleid = GetPlayerVehicleID(playerid);

    if(IsPlayerInVehicle(playerid,vehicleid))
    {
		for(new i = 0; i < MAX_INVALID_NOS_VEHICLES; i++)
		{
		    if(GetVehicleModel(vehicleid) == InvalidNosVehicles[i])
		    {
		        return true;
		    }
		}
    }
    return false;
}

public OnPlayerConnect(playerid)
{
    GivePlayerMoney(playerid, 0);
    new pName[30], string[128];
    GetPlayerName(playerid, pName, 30);
    format(string, 256, "%s entrou no server.", pName);
    SendClientMessageToAll(0x33AA33AA,string);
    SendClientMessage(playerid, 0x33CCFFAA, "Se bem Vindo ao Servidor de Drift Nacional!");
    SendClientMessage(playerid, 0x33CCFFAA, "[DOD] - Drift Or Die");
    SendClientMessage(playerid, 0x33CCFFAA, "Escreve /cmd para aprenderes alguns comandos!");
	return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    new pName[30], string[128];
    GetPlayerName(playerid, pName, 30);
    format(string, 256, "%s saiu do server.", pName);
    SendClientMessageToAll(0xA52A2AAA,string);
   	return 1;
}
public OnPlayerSpawn(playerid)
{
    SetPlayerHealth(playerid,9000.0);
	SetPlayerToTeamColour(playerid);
    return 1;
}
SetPlayerTeamFromClass(playerid, classid)
{
    if(classid == 0)
    {
        gTeam[playerid] = DOD;
    }
}
SetPlayerToTeamColour(playerid)
{
    if(gTeam[playerid] == DOD)
    {
        SetPlayerColor(playerid,DOD_COLOUR); //Green
    }
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2)
    {
        new CarCheck = GetPlayerVehicleID(playerid);
        if(CarCheck == Cars[DOD] )
        {
            if(gTeam[playerid] != 1)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "You Don't Belong to DOD Crew!");
                return 1;
            }
        }
        return 1;
    }
    return 1;
}
This should work:

pawn Code:
#include <a_samp>

#define SPECIAL_ACTION_PISSING 68
#define MAX_INVALID_NOS_VEHICLES 29
#define DOD 1
#define DOD_COLOUR 0x00820FAA
#define COLOR_RED 0xFF0000AA

new Car1,Car2,Car3,Car4;
new gTeam[MAX_PLAYERS];
//new ELEGY;
//new ELEGY2;
//new ELEGY3;
//new JESTER;
//new JESTER2;
//new STRATUM;
//new STRATUM2;
//new STRATUM3;
//new STRATUM4;
//new TE1;

forward NitroReset();

main()
{
    print("\n __________________________________\n");
    print("\n|                      Drift                           |\n");
    print("\n|__________________________________|\n");
}

public OnGameModeInit()
{
    SetGameModeText("Drift");
    UsePlayerPedAnims();
    SetTimer("NitroReset", 1500, 1);
    //Funзхes para Spawn de Members - DOD
    AddPlayerClass(299,2497.2693,-1676.9578,13.3398,23.6501,0,0,0,0,0,0);
    AddPlayerClass(104,1544.0514,-1675.7766,13.5577,98.0974,0,0,0,0,0,0);
    Car1 = AddStaticVehicleEx(562,-2506.870117, -635.783325, 134.652481, 359.465423, -1, -1, 10000);
    Car2 = AddStaticVehicleEx(429,-2494.236083, -633.563049, 134.012542, 359.016265, -1, -1, 10000);
    Car3 = AddStaticVehicle(507,-2530.7561,-618.6442,132.1928,269.1777,1,1);
    Car4 = AddStaticVehicle(436,-2529.5754,-606.6457,132.1944,270.8741,1,1);
    return 1;
}
public OnGameModeExit()
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    SetPlayerScore(playerid, GetPlayerMoney(playerid));
    return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerTeamFromClass(playerid, classid);
    return 1;
}

public NitroReset()
{
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
        if(!IsPlayerInInvalidNosVehicle(i,GetPlayerVehicleID(i)))
        {
                new vehicle = GetPlayerVehicleID(i);
                AddVehicleComponent(vehicle, 1010);
        }
    }
}

IsPlayerInInvalidNosVehicle(playerid,vehicleid)
{


    new InvalidNosVehicles[MAX_INVALID_NOS_VEHICLES] =
    {
    581,523,462,521,463,522,461,448,468,586,
    509,481,510,472,473,493,595,484,430,453,
    452,446,454,590,569,537,538,570,449
    };

    vehicleid = GetPlayerVehicleID(playerid);

    if(IsPlayerInVehicle(playerid,vehicleid))
    {
        for(new i = 0; i < MAX_INVALID_NOS_VEHICLES; i++)
        {
            if(GetVehicleModel(vehicleid) == InvalidNosVehicles[i])
            {
                return true;
            }
        }
    }
    return false;
}

public OnPlayerConnect(playerid)
{
    GivePlayerMoney(playerid, 0);
    new pName[30], string[128];
    GetPlayerName(playerid, pName, 30);
    format(string, 256, "%s entrou no server.", pName);
    SendClientMessageToAll(0x33AA33AA,string);
    SendClientMessage(playerid, 0x33CCFFAA, "Se bem Vindo ao Servidor de Drift Nacional!");
    SendClientMessage(playerid, 0x33CCFFAA, "[DOD] - Drift Or Die");
    SendClientMessage(playerid, 0x33CCFFAA, "Escreve /cmd para aprenderes alguns comandos!");
    return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    new pName[30], string[128];
    GetPlayerName(playerid, pName, 30);
    format(string, 256, "%s saiu do server.", pName);
    SendClientMessageToAll(0xA52A2AAA,string);
    return 1;
}
public OnPlayerSpawn(playerid)
{
    SetPlayerHealth(playerid,9000.0);
    SetPlayerToTeamColour(playerid);
    return 1;
}
SetPlayerTeamFromClass(playerid, classid)
{
    if(classid == 0)
    {
        gTeam[playerid] = DOD;
    }
}
SetPlayerToTeamColour(playerid)
{
    if(gTeam[playerid] == DOD)
    {
        SetPlayerColor(playerid,DOD_COLOUR); //Green
    }
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2)
    {
        new CarCheck = GetPlayerVehicleID(playerid);
        if(CarCheck == Car1 || Car2 || Car3 || Car4 )
        {
            if(gTeam[playerid] != 1)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "You Don't Belong to DOD Crew!");
                return 1;
            }
        }
        return 1;
    }
    return 1;
}
Reply


Messages In This Thread
Team Cars and Team Players - by Emanuel_Rodriguez - 17.07.2010, 20:30
Re: Team Cars and Team Players - by Thebest96 - 17.07.2010, 21:02
Re: Team Cars and Team Players - by [XST]O_x - 17.07.2010, 21:05
Re: Team Cars and Team Players - by Thebest96 - 17.07.2010, 21:08
Re: Team Cars and Team Players - by Desertsoulz - 20.07.2010, 23:35
Re: Team Cars and Team Players - by Scenario - 20.07.2010, 23:46
Re: Team Cars and Team Players - by 3ventic - 26.07.2010, 15:22
Re: Team Cars and Team Players - by R@ger - 26.07.2010, 15:34
Re: Team Cars and Team Players - by Steven82 - 29.07.2010, 19:30
Re: Team Cars and Team Players - by Scenario - 30.07.2010, 03:40
Re: Team Cars and Team Players - by CEZALAND - 31.07.2010, 22:17
Re: Team Cars and Team Players - by sDAAw - 03.08.2010, 22:27
Re: Team Cars and Team Players - by MadalinX5 - 08.08.2010, 10:08
Re: Team Cars and Team Players - by nexco - 21.08.2010, 20:29
Re: Team Cars and Team Players - by bertuspiteri - 22.08.2010, 20:18
Re: Team Cars and Team Players - by Nekrus2 - 22.08.2010, 23:20
Re: Team Cars and Team Players - by sekol - 30.08.2010, 13:17
Re: Team Cars and Team Players - by Yamoo - 30.08.2010, 17:11
Re: Team Cars and Team Players - by Thebest96 - 01.09.2010, 14:47
Re: Team Cars and Team Players - by Thebest96 - 03.09.2010, 06:25
Re: Team Cars and Team Players - by Nekrus2 - 03.09.2010, 16:40
Re: Team Cars and Team Players - by Nekrus2 - 03.09.2010, 16:42
Re: Team Cars and Team Players - by Thebest96 - 03.09.2010, 21:19
Re: Team Cars and Team Players - by tanush - 16.10.2010, 19:11
Re: Team Cars and Team Players - by IndoScripter - 29.10.2010, 12:03
Re: Team Cars and Team Players - by Tessar - 30.10.2010, 19:45
Re: Team Cars and Team Players - by fysssical - 17.11.2010, 15:33
Re: Team Cars and Team Players - by Miado_Hulk - 20.11.2010, 16:36
Re: Team Cars and Team Players - by ollis93 - 21.11.2010, 17:57
Re: Team Cars and Team Players - by EstSampBro - 20.06.2013, 20:12
Re: Team Cars and Team Players - by hitman14 - 12.08.2014, 12:10
Re: Team Cars and Team Players - by killerbigpoint - 10.10.2014, 16:55
Re: Team Cars and Team Players - by TheRaGeLord - 04.01.2015, 12:59
Re: Team Cars and Team Players - by Ankon - 12.10.2015, 03:58

Forum Jump:


Users browsing this thread: 8 Guest(s)