symbol already defined: "OnPlayerKeyStateChange" HELP
#1

I've used this command to replace /enter and enter only by pressing one key and i get this error


Код:
(48681) : error 021: symbol already defined: "OnPlayerKeyStateChange"
(/enter command line 39141):

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  if((newkeys == KEY_CROUCH))
  {

    if(GetPVarInt(playerid, "PBM") > 0) {
        SendClientMessage(playerid, COLOR_WHITE, "You can't do this while being in a arena!");
        return 1;
    }
    if(PlayerCuffed[playerid] >= 1)
	{
        SendClientMessage(playerid, COLOR_WHITE, "You can't do this right now.");
        return 1;
    }
    if(PlayerInfo[playerid][pJailed] > 0)
	{
        SendClientMessage(playerid, COLOR_WHITE, "You can't do this right now.");
        return 1;
    }

	new string[128];
    for(new i = 0; i < sizeof(DDoorsInfo); i++)
	{
        if(IsPlayerInRangeOfPoint(playerid,3.0,DDoorsInfo[i][ddExteriorX], DDoorsInfo[i][ddExteriorY], DDoorsInfo[i][ddExteriorZ]) && PlayerInfo[playerid][pVW] == DDoorsInfo[i][ddExteriorVW])
		{
            if(DDoorsInfo[i][ddVIP] > 0 && PlayerInfo[playerid][pDonator] < DDoorsInfo[i][ddVIP]) {
                SendClientMessage(playerid, COLOR_GRAD2, "You can't enter, you're not a high enough Donator level.");
                return 1;
            }

            if(DDoorsInfo[i][ddGang] > 0) {
                if(PlayerInfo[playerid][pGang] != DDoorsInfo[i][ddGang]) {
                    SendClientMessage(playerid, COLOR_GRAD2, "You can't enter, this door is gang restricted.");
                    return 1;
                }
            }

            if(DDoorsInfo[i][ddFaction] > 0) {
				if(PlayerInfo[playerid][pFaction] != DDoorsInfo[i][ddFaction])
				{
					SendClientMessage(playerid, COLOR_GRAD2, "You can't enter, this door is faction restricted.");
					return 1;
				}
            }

            if(DDoorsInfo[i][ddAdmin] > 0 && PlayerInfo[playerid][pAdmin] < DDoorsInfo[i][ddAdmin]) {
                SendClientMessage(playerid, COLOR_GRAD2, "You can't enter, you're not a high enough admin level.");
                return 1;
            }

            if(DDoorsInfo[i][ddWanted] > 0 && PlayerInfo[playerid][pWantedLevel] != 0) {
                SendClientMessage(playerid, COLOR_GRAD2, "You can't enter, this door restricts those with wanted levels.");
                return 1;
            }

			if(DDoorsInfo[i][ddLocked] == 1) {
			    return SendClientMessage(playerid, COLOR_GRAD2, "This door is currently locked.");
			}

			format(string, sizeof(string), "* %s has entered the building.", GetPlayerNameEx(playerid));
			ProxDetector(25.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

            SetPlayerInterior(playerid,DDoorsInfo[i][ddInteriorInt]);
            PlayerInfo[playerid][pInt] = DDoorsInfo[i][ddInteriorInt];
            PlayerInfo[playerid][pVW] = DDoorsInfo[i][ddInteriorVW];
            SetPlayerVirtualWorld(playerid, DDoorsInfo[i][ddInteriorVW]);
            if(DDoorsInfo[i][ddCustomInterior]) {
                TogglePlayerControllable(playerid, 0);
				for(new o = 0; o < 6; o++)
				{
					TextDrawShowForPlayer(playerid, ObjectsLoadingTD[o]);
				}
                SetPVarInt(playerid, "LoadingObjects", 1);
                SetTimerEx("SafeLoadObjects", 3000, 0, "d", playerid);
            }
            if(DDoorsInfo[i][ddVehicleAble] > 0 && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
                SetVehiclePos(GetPlayerVehicleID(playerid), DDoorsInfo[i][ddInteriorX],DDoorsInfo[i][ddInteriorY],DDoorsInfo[i][ddInteriorZ]);
                SetVehicleZAngle(GetPlayerVehicleID(playerid), DDoorsInfo[i][ddInteriorA]);
                SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), DDoorsInfo[i][ddInteriorVW]);
                LinkVehicleToInterior(GetPlayerVehicleID(playerid), DDoorsInfo[i][ddInteriorInt]);
            }
            else {
                SetPlayerPos(playerid,DDoorsInfo[i][ddInteriorX],DDoorsInfo[i][ddInteriorY],DDoorsInfo[i][ddInteriorZ]);
                SetPlayerFacingAngle(playerid,DDoorsInfo[i][ddInteriorA]);
                SetCameraBehindPlayer(playerid);
            }
			foreach(Player, x)
			{
                if(IsABoomboxNearby(DDoorsInfo[i][ddInteriorX] ,DDoorsInfo[i][ddInteriorY], DDoorsInfo[i][ddInteriorZ], x) < 150.0 && DDoorsInfo[i][ddInteriorVW] == BoomboxInfo[x][bbVW] && DDoorsInfo[i][ddInteriorInt] == BoomboxInfo[x][bbInt])
				{
					PlayAudioStreamForPlayer(playerid, VehicleRadioListing[BoomboxInfo[x][bbStation]-1][radiourl], BoomboxInfo[x][bbPosX], BoomboxInfo[x][bbPosY], BoomboxInfo[x][bbPosZ], 50.0, 1);
				}
			}
            return Streamer_UpdateEx(playerid, DDoorsInfo[i][ddInteriorX],DDoorsInfo[i][ddInteriorY],DDoorsInfo[i][ddInteriorZ]);
        }
    }
    for(new i = 0; i < sizeof(HouseInfo); i++)
	{
        if(IsPlayerInRangeOfPoint(playerid,3,HouseInfo[i][hExteriorX], HouseInfo[i][hExteriorY], HouseInfo[i][hExteriorZ]))
		{
            if(PlayerInfo[playerid][pHouse] == i || PlayerInfo[playerid][pHouse2] == i || HouseInfo[i][hLock] == 0 || PlayerInfo[playerid][pRenting] == i)
			{
			    if(PlayerInfo[playerid][pHouse] == i || PlayerInfo[playerid][pHouse2] == i)
			    {
					format(string, sizeof(string), "* %s has entered their house.", GetPlayerNameEx(playerid));
					ProxDetector(25.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			    }
			    else
			    {
					format(string, sizeof(string), "* %s has entered %s's house.", GetPlayerNameEx(playerid), HouseInfo[i][hOwner]);
					ProxDetector(25.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}

                SetPlayerInterior(playerid,HouseInfo[i][hHInteriorWorld]);
                PlayerInfo[playerid][pInt] = HouseInfo[i][hHInteriorWorld];
                PlayerInfo[playerid][pVW] = i+60000;
                SetPlayerVirtualWorld(playerid, i+60000);
                if(HouseInfo[i][hCustomInterior] == 1)
				{
                    TogglePlayerControllable(playerid, 0);
					for(new o = 0; o < 6; o++)
					{
						TextDrawShowForPlayer(playerid, ObjectsLoadingTD[o]);
					}
                    SetPVarInt(playerid, "LoadingObjects", 1);
                    SetTimerEx("SafeLoadObjects", 3000, 0, "d", playerid);
                }
                SetPlayerPos(playerid,HouseInfo[i][hInteriorX],HouseInfo[i][hInteriorY],HouseInfo[i][hInteriorZ]);
                SetPlayerFacingAngle(playerid,HouseInfo[i][hInteriorA]);
                SetCameraBehindPlayer(playerid);
                if(PlayerInfo[playerid][pHouse] == i || PlayerInfo[playerid][pHouse2] == i)
                {
                	GameTextForPlayer(playerid, "~w~Welcome Home", 5000, 1);
			 	}
 				foreach(Player, x)
				{
                	if(IsABoomboxNearby(HouseInfo[i][hInteriorX], HouseInfo[i][hInteriorY], HouseInfo[i][hInteriorZ], x) < 150.0 && i+60000 == BoomboxInfo[x][bbVW] && HouseInfo[i][hHInteriorWorld] == BoomboxInfo[x][bbInt])
					{
						PlayAudioStreamForPlayer(playerid, VehicleRadioListing[BoomboxInfo[x][bbStation]-1][radiourl], BoomboxInfo[x][bbPosX], BoomboxInfo[x][bbPosY], BoomboxInfo[x][bbPosZ], 50.0, 1);
					}
				}
				Streamer_UpdateEx(playerid, HouseInfo[i][hInteriorX],HouseInfo[i][hInteriorY],HouseInfo[i][hInteriorZ]);
            }
            else
			{
                GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
            }
            return 1;
        }
    }

    // Hitman HQ
    if(IsPlayerInRangeOfPoint(playerid, 2.0,  1938.545898, 165.629531, 37.281250))
	{
        if(PlayerInfo[playerid][pFaction] == 4 || PlayerInfo[playerid][pLeader] == 4)
		{
            SetPlayerVirtualWorld(playerid, 666420);
            PlayerInfo[playerid][pVW] = 666420;
            SetPlayerInterior(playerid, 42);
            PlayerInfo[playerid][pInt] = 42;
            SetPlayerPos(playerid, 1277.019165, -758.428771, 5080.750000);
            SetPlayerFacingAngle(playerid, 358.16);
            SetCameraBehindPlayer(playerid);

    		TogglePlayerControllable(playerid, 0);
			for(new o = 0; o < 6; o++)
			{
				TextDrawShowForPlayer(playerid, ObjectsLoadingTD[o]);
			}
   			SetPVarInt(playerid, "LoadingObjects", 1);
   			SetTimerEx("SafeLoadObjects", 3000, 0, "d", playerid);
   			SendClientMessage(playerid, COLOR_WHITE, "You can /order weaponry in the armory room.");
        }
    }

    // The Lubu Gentlemen's Club
    else if(IsPlayerInRangeOfPoint(playerid, 3.0,  511.817230, -1510.971679, 14.566996))
	{
		format(string, sizeof(string), "* %s has entered The Lubu Gentlemen's Club.", GetPlayerNameEx(playerid));
		ProxDetector(25.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

 		SetPlayerVirtualWorld(playerid, 373737);
   		PlayerInfo[playerid][pVW] = 373737;
     	SetPlayerInterior(playerid, 37);
      	PlayerInfo[playerid][pInt] = 37;
       	SetPlayerPos(playerid, -1077.946533, 613.206665, 1116.507812);
        SetPlayerFacingAngle(playerid, 92.42);
        SetCameraBehindPlayer(playerid);

		TogglePlayerControllable(playerid, 0);
		for(new o = 0; o < 6; o++)
		{
			TextDrawShowForPlayer(playerid, ObjectsLoadingTD[o]);
		}
		SetPVarInt(playerid, "LoadingObjects", 1);
		SetTimerEx("SafeLoadObjects", 3000, 0, "d", playerid);

		PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=242774", -1087.677978, 615.239807, 1116.507812, 40.0, 1);
    }

    // The Tableau Club
    else if(IsPlayerInRangeOfPoint(playerid, 3.0,  561.802795, -1506.722412, 14.548986))
	{
		format(string, sizeof(string), "* %s has entered The Tableau Club.", GetPlayerNameEx(playerid));
		ProxDetector(25.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

 		SetPlayerVirtualWorld(playerid, 363636);
   		PlayerInfo[playerid][pVW] = 363636;
     	SetPlayerInterior(playerid, 36);
      	PlayerInfo[playerid][pInt] = 36;
       	SetPlayerPos(playerid, 308.045654, 1053.886840, 1098.540039);
        SetPlayerFacingAngle(playerid, 267.57);
        SetCameraBehindPlayer(playerid);

		TogglePlayerControllable(playerid, 0);
		for(new o = 0; o < 6; o++)
		{
			TextDrawShowForPlayer(playerid, ObjectsLoadingTD[o]);
		}
		SetPVarInt(playerid, "LoadingObjects", 1);
		SetTimerEx("SafeLoadObjects", 3000, 0, "d", playerid);

		PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1377200", 321.139465, 1034.947753, 1098.914062, 120.0, 1);
    }

    // The Tableau Club (VIP ROOM)
    else if(IsPlayerInRangeOfPoint(playerid, 3.0,  307.904296, 1025.602294, 1098.540039))
	{
	    if(GetPlayerCash(playerid) >= 100)
	    {
			format(string, sizeof(string), "* %s has entered The Tableau VIP Room.", GetPlayerNameEx(playerid));
			ProxDetector(25.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

			GivePlayerCash(playerid, -100);
			GameTextForPlayer(playerid, "~r~-$100", 3000, 1);

 			SetPlayerVirtualWorld(playerid, 363636);
   			PlayerInfo[playerid][pVW] = 363636;
     		SetPlayerInterior(playerid, 36);
      		PlayerInfo[playerid][pInt] = 36;
       		SetPlayerPos(playerid, 293.066436, 1029.785278, 1104.560058);
        	SetPlayerFacingAngle(playerid, 352.47);
        	SetCameraBehindPlayer(playerid);
		 }
		 else
		 {
		    SendClientMessage(playerid, COLOR_GREY, " You do not have the cash for that.");
		 }
    }

    // Santa Maria Surfer's Lounge
    else if(IsPlayerInRangeOfPoint(playerid, 3.0,  387.958374, -1870.688110, 7.835937))
	{
		format(string, sizeof(string), "* %s has entered Santa Maria Surfer's Lounge.", GetPlayerNameEx(playerid));
		ProxDetector(25.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

 		SetPlayerVirtualWorld(playerid, 353535);
   		PlayerInfo[playerid][pVW] = 353535;
     	SetPlayerInterior(playerid, 35);
      	PlayerInfo[playerid][pInt] = 35;
       	SetPlayerPos(playerid, 271.742034, 1074.419677, 5096.750000);
        SetPlayerFacingAngle(playerid, 86.54);
        SetCameraBehindPlayer(playerid);

		TogglePlayerControllable(playerid, 0);
		for(new o = 0; o < 6; o++)
		{
			TextDrawShowForPlayer(playerid, ObjectsLoadingTD[o]);
		}
		SetPVarInt(playerid, "LoadingObjects", 1);
		SetTimerEx("SafeLoadObjects", 3000, 0, "d", playerid);

		PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=21585", 271.742034, 1074.419677, 5096.750000, 120.0, 1);
    }

	new vehicleid = GetPlayerVehicleID(playerid);
	new closestcar = GetClosestCar(playerid, vehicleid);
	if(IsPlayerInRangeOfVehicle(playerid, closestcar, 6.0) && GetVehicleModel(closestcar) == 519)
	{
	    if(VehicleStatus{closestcar} == 1) return SendClientMessage(playerid, COLOR_WHITE, "You're not allowed to enter this Shamal as it's been damaged!");
   		format(string, sizeof(string), "* %s enters the Shamal airplane as a passenger.", GetPlayerNameEx(playerid));
		ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
     	SetPlayerPos(playerid, 2.509036, 23.118730, 1199.593750);
     	SetPlayerFacingAngle(playerid, 82.14);
        SetCameraBehindPlayer(playerid);
		PlayerInfo[playerid][pVW] = closestcar;
		SetPlayerVirtualWorld(playerid, closestcar);
		PlayerInfo[playerid][pInt] = 1;
        SetPlayerInterior(playerid, 1);
		InsideShamal[playerid] = closestcar;
		SendClientMessage(playerid, COLOR_WHITE, "Type /exit near the door to exit the vehicle, or /window to look outside.");
		
		foreach(Player, x)
		{
 			if(IsABoomboxNearby(2.509036, 23.118730, 1199.593750, x) < 150.0 && closestcar == BoomboxInfo[x][bbVW] && BoomboxInfo[x][bbInt] == 1)
			{
				PlayAudioStreamForPlayer(playerid, VehicleRadioListing[BoomboxInfo[x][bbStation]-1][radiourl], BoomboxInfo[x][bbPosX], BoomboxInfo[x][bbPosY], BoomboxInfo[x][bbPosZ], 50.0, 1);
			}
		}
	}
  }
  return 1;
}
(line 48681- where i get the error):

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
    if(IsPlayerNPC(playerid))
	if((newkeys & KEY_FIRE) && GetPVarInt(playerid, "SpeedRadar") == 1 && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
	{
	    if(GetPVarInt(playerid, "RadarTimeout") == 0)
	    {
			if(GetPlayerWeapon(playerid) == 43)
			{
			    new Float:x,Float:y,Float:z;
				foreach(Player, i)
				{
				    if(IsPlayerStreamedIn(i, playerid))
				    {
					    GetPlayerPos(i,x,y,z);
					    if(IsPlayerAimingAt(playerid,x,y,z,10))
					    {
							new string[68];
							format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~b~License Plate: ~w~%d~n~~b~Speed: ~w~%.0f MPH", GetPlayerVehicleID(i), fVehSpeed[i]);
							GameTextForPlayer(playerid, string,3500, 3);
							format(string, sizeof(string), "License Plate: %d. Speed: %.0f MPH", GetPlayerVehicleID(i), fVehSpeed[i]);
							SendClientMessage(playerid, COLOR_GRAD4, string);
							SetPVarInt(playerid, "RadarTimeout", 1);
							SetTimerEx("RadarCooldown", 3000, 0, "i", playerid);
							return 1;
						}
					}
			    }
			}
		}
	}.....
Reply
#2

I mean how can i use OnPlayerKeyStateChange another time on the script ! please help me asap
Reply
#3

Well firstly I suggest that you don't bump your topic after five minutes of posting it.

Secondly, you cant have two functions in your gamemode with the same name.

In this case, you can simply merge each function together, like so:

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    // (line 48681- where i get the error):
    if(IsPlayerNPC(playerid)) return 1;
    if((newkeys & KEY_FIRE) && GetPVarInt(playerid, "SpeedRadar") == 1 && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
    {
        if(GetPVarInt(playerid, "RadarTimeout") == 0)
        {
            if(GetPlayerWeapon(playerid) == 43)
            {
                new Float:x,Float:y,Float:z;
                foreach(Player, i)
                {
                    if(IsPlayerStreamedIn(i, playerid))
                    {
                        GetPlayerPos(i,x,y,z);
                        if(IsPlayerAimingAt(playerid,x,y,z,10))
                        {
                            new string[68];
                            format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~b~License Plate: ~w~%d~n~~b~Speed: ~w~%.0f MPH", GetPlayerVehicleID(i), fVehSpeed[i]);
                            GameTextForPlayer(playerid, string,3500, 3);
                            format(string, sizeof(string), "License Plate: %d. Speed: %.0f MPH", GetPlayerVehicleID(i), fVehSpeed[i]);
                            SendClientMessage(playerid, COLOR_GRAD4, string);
                            SetPVarInt(playerid, "RadarTimeout", 1);
                            SetTimerEx("RadarCooldown", 3000, 0, "i", playerid);
                            return 1;
                        }
                    }
                }
            }
        }
    } // .....
   
    // (/enter command line 39141):
    if((newkeys == KEY_CROUCH))
    {
        if(GetPVarInt(playerid, "PBM") > 0) {
            SendClientMessage(playerid, COLOR_WHITE, "You can't do this while being in a arena!");
            return 1;
        }
        if(PlayerCuffed[playerid] >= 1)
        {
            SendClientMessage(playerid, COLOR_WHITE, "You can't do this right now.");
            return 1;
        }
        if(PlayerInfo[playerid][pJailed] > 0)
        {
            SendClientMessage(playerid, COLOR_WHITE, "You can't do this right now.");
            return 1;
        }
       
        new string[128];
        for(new i = 0; i < sizeof(DDoorsInfo); i++)
        {
            if(IsPlayerInRangeOfPoint(playerid,3.0,DDoorsInfo[i][ddExteriorX], DDoorsInfo[i][ddExteriorY], DDoorsInfo[i][ddExteriorZ]) && PlayerInfo[playerid][pVW] == DDoorsInfo[i][ddExteriorVW])
            {
                if(DDoorsInfo[i][ddVIP] > 0 && PlayerInfo[playerid][pDonator] < DDoorsInfo[i][ddVIP]) {
                    SendClientMessage(playerid, COLOR_GRAD2, "You can't enter, you're not a high enough Donator level.");
                    return 1;
                }
               
                if(DDoorsInfo[i][ddGang] > 0) {
                    if(PlayerInfo[playerid][pGang] != DDoorsInfo[i][ddGang]) {
                        SendClientMessage(playerid, COLOR_GRAD2, "You can't enter, this door is gang restricted.");
                        return 1;
                    }
                }
               
                if(DDoorsInfo[i][ddFaction] > 0) {
                    if(PlayerInfo[playerid][pFaction] != DDoorsInfo[i][ddFaction])
                    {
                        SendClientMessage(playerid, COLOR_GRAD2, "You can't enter, this door is faction restricted.");
                        return 1;
                    }
                }
               
                if(DDoorsInfo[i][ddAdmin] > 0 && PlayerInfo[playerid][pAdmin] < DDoorsInfo[i][ddAdmin]) {
                    SendClientMessage(playerid, COLOR_GRAD2, "You can't enter, you're not a high enough admin level.");
                    return 1;
                }
               
                if(DDoorsInfo[i][ddWanted] > 0 && PlayerInfo[playerid][pWantedLevel] != 0) {
                    SendClientMessage(playerid, COLOR_GRAD2, "You can't enter, this door restricts those with wanted levels.");
                    return 1;
                }
               
                if(DDoorsInfo[i][ddLocked] == 1) {
                    return SendClientMessage(playerid, COLOR_GRAD2, "This door is currently locked.");
                }
               
                format(string, sizeof(string), "* %s has entered the building.", GetPlayerNameEx(playerid));
                ProxDetector(25.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
               
                SetPlayerInterior(playerid,DDoorsInfo[i][ddInteriorInt]);
                PlayerInfo[playerid][pInt] = DDoorsInfo[i][ddInteriorInt];
                PlayerInfo[playerid][pVW] = DDoorsInfo[i][ddInteriorVW];
                SetPlayerVirtualWorld(playerid, DDoorsInfo[i][ddInteriorVW]);
                if(DDoorsInfo[i][ddCustomInterior]) {
                    TogglePlayerControllable(playerid, 0);
                    for(new o = 0; o < 6; o++)
                    {
                        TextDrawShowForPlayer(playerid, ObjectsLoadingTD[o]);
                    }
                    SetPVarInt(playerid, "LoadingObjects", 1);
                    SetTimerEx("SafeLoadObjects", 3000, 0, "d", playerid);
                }
                if(DDoorsInfo[i][ddVehicleAble] > 0 && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
                    SetVehiclePos(GetPlayerVehicleID(playerid), DDoorsInfo[i][ddInteriorX],DDoorsInfo[i][ddInteriorY],DDoorsInfo[i][ddInteriorZ]);
                    SetVehicleZAngle(GetPlayerVehicleID(playerid), DDoorsInfo[i][ddInteriorA]);
                    SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), DDoorsInfo[i][ddInteriorVW]);
                    LinkVehicleToInterior(GetPlayerVehicleID(playerid), DDoorsInfo[i][ddInteriorInt]);
                }
                else {
                    SetPlayerPos(playerid,DDoorsInfo[i][ddInteriorX],DDoorsInfo[i][ddInteriorY],DDoorsInfo[i][ddInteriorZ]);
                    SetPlayerFacingAngle(playerid,DDoorsInfo[i][ddInteriorA]);
                    SetCameraBehindPlayer(playerid);
                }
                foreach(Player, x)
                {
                    if(IsABoomboxNearby(DDoorsInfo[i][ddInteriorX] ,DDoorsInfo[i][ddInteriorY], DDoorsInfo[i][ddInteriorZ], x) < 150.0 && DDoorsInfo[i][ddInteriorVW] == BoomboxInfo[x][bbVW] && DDoorsInfo[i][ddInteriorInt] == BoomboxInfo[x][bbInt])
                    {
                        PlayAudioStreamForPlayer(playerid, VehicleRadioListing[BoomboxInfo[x][bbStation]-1][radiourl], BoomboxInfo[x][bbPosX], BoomboxInfo[x][bbPosY], BoomboxInfo[x][bbPosZ], 50.0, 1);
                    }
                }
                return Streamer_UpdateEx(playerid, DDoorsInfo[i][ddInteriorX],DDoorsInfo[i][ddInteriorY],DDoorsInfo[i][ddInteriorZ]);
            }
        }
        for(new i = 0; i < sizeof(HouseInfo); i++)
        {
            if(IsPlayerInRangeOfPoint(playerid,3,HouseInfo[i][hExteriorX], HouseInfo[i][hExteriorY], HouseInfo[i][hExteriorZ]))
            {
                if(PlayerInfo[playerid][pHouse] == i || PlayerInfo[playerid][pHouse2] == i || HouseInfo[i][hLock] == 0 || PlayerInfo[playerid][pRenting] == i)
                {
                    if(PlayerInfo[playerid][pHouse] == i || PlayerInfo[playerid][pHouse2] == i)
                    {
                        format(string, sizeof(string), "* %s has entered their house.", GetPlayerNameEx(playerid));
                        ProxDetector(25.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    }
                    else
                    {
                        format(string, sizeof(string), "* %s has entered %s's house.", GetPlayerNameEx(playerid), HouseInfo[i][hOwner]);
                        ProxDetector(25.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    }
                   
                    SetPlayerInterior(playerid,HouseInfo[i][hHInteriorWorld]);
                    PlayerInfo[playerid][pInt] = HouseInfo[i][hHInteriorWorld];
                    PlayerInfo[playerid][pVW] = i+60000;
                    SetPlayerVirtualWorld(playerid, i+60000);
                    if(HouseInfo[i][hCustomInterior] == 1)
                    {
                        TogglePlayerControllable(playerid, 0);
                        for(new o = 0; o < 6; o++)
                        {
                            TextDrawShowForPlayer(playerid, ObjectsLoadingTD[o]);
                        }
                        SetPVarInt(playerid, "LoadingObjects", 1);
                        SetTimerEx("SafeLoadObjects", 3000, 0, "d", playerid);
                    }
                    SetPlayerPos(playerid,HouseInfo[i][hInteriorX],HouseInfo[i][hInteriorY],HouseInfo[i][hInteriorZ]);
                    SetPlayerFacingAngle(playerid,HouseInfo[i][hInteriorA]);
                    SetCameraBehindPlayer(playerid);
                    if(PlayerInfo[playerid][pHouse] == i || PlayerInfo[playerid][pHouse2] == i)
                    {
                        GameTextForPlayer(playerid, "~w~Welcome Home", 5000, 1);
                    }
                    foreach(Player, x)
                    {
                        if(IsABoomboxNearby(HouseInfo[i][hInteriorX], HouseInfo[i][hInteriorY], HouseInfo[i][hInteriorZ], x) < 150.0 && i+60000 == BoomboxInfo[x][bbVW] && HouseInfo[i][hHInteriorWorld] == BoomboxInfo[x][bbInt])
                        {
                            PlayAudioStreamForPlayer(playerid, VehicleRadioListing[BoomboxInfo[x][bbStation]-1][radiourl], BoomboxInfo[x][bbPosX], BoomboxInfo[x][bbPosY], BoomboxInfo[x][bbPosZ], 50.0, 1);
                        }
                    }
                    Streamer_UpdateEx(playerid, HouseInfo[i][hInteriorX],HouseInfo[i][hInteriorY],HouseInfo[i][hInteriorZ]);
                }
                else
                {
                    GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
                }
                return 1;
            }
        }
       
        // Hitman HQ
        if(IsPlayerInRangeOfPoint(playerid, 2.0,  1938.545898, 165.629531, 37.281250))
        {
            if(PlayerInfo[playerid][pFaction] == 4 || PlayerInfo[playerid][pLeader] == 4)
            {
                SetPlayerVirtualWorld(playerid, 666420);
                PlayerInfo[playerid][pVW] = 666420;
                SetPlayerInterior(playerid, 42);
                PlayerInfo[playerid][pInt] = 42;
                SetPlayerPos(playerid, 1277.019165, -758.428771, 5080.750000);
                SetPlayerFacingAngle(playerid, 358.16);
                SetCameraBehindPlayer(playerid);
               
                TogglePlayerControllable(playerid, 0);
                for(new o = 0; o < 6; o++)
                {
                    TextDrawShowForPlayer(playerid, ObjectsLoadingTD[o]);
                }
                SetPVarInt(playerid, "LoadingObjects", 1);
                SetTimerEx("SafeLoadObjects", 3000, 0, "d", playerid);
                SendClientMessage(playerid, COLOR_WHITE, "You can /order weaponry in the armory room.");
            }
        }
       
        // The Lubu Gentlemen's Club
        else if(IsPlayerInRangeOfPoint(playerid, 3.0,  511.817230, -1510.971679, 14.566996))
        {
            format(string, sizeof(string), "* %s has entered The Lubu Gentlemen's Club.", GetPlayerNameEx(playerid));
            ProxDetector(25.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
           
            SetPlayerVirtualWorld(playerid, 373737);
            PlayerInfo[playerid][pVW] = 373737;
            SetPlayerInterior(playerid, 37);
            PlayerInfo[playerid][pInt] = 37;
            SetPlayerPos(playerid, -1077.946533, 613.206665, 1116.507812);
            SetPlayerFacingAngle(playerid, 92.42);
            SetCameraBehindPlayer(playerid);
           
            TogglePlayerControllable(playerid, 0);
            for(new o = 0; o < 6; o++)
            {
                TextDrawShowForPlayer(playerid, ObjectsLoadingTD[o]);
            }
            SetPVarInt(playerid, "LoadingObjects", 1);
            SetTimerEx("SafeLoadObjects", 3000, 0, "d", playerid);
           
            PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=242774", -1087.677978, 615.239807, 1116.507812, 40.0, 1);
        }
       
        // The Tableau Club
        else if(IsPlayerInRangeOfPoint(playerid, 3.0,  561.802795, -1506.722412, 14.548986))
        {
            format(string, sizeof(string), "* %s has entered The Tableau Club.", GetPlayerNameEx(playerid));
            ProxDetector(25.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
           
            SetPlayerVirtualWorld(playerid, 363636);
            PlayerInfo[playerid][pVW] = 363636;
            SetPlayerInterior(playerid, 36);
            PlayerInfo[playerid][pInt] = 36;
            SetPlayerPos(playerid, 308.045654, 1053.886840, 1098.540039);
            SetPlayerFacingAngle(playerid, 267.57);
            SetCameraBehindPlayer(playerid);
           
            TogglePlayerControllable(playerid, 0);
            for(new o = 0; o < 6; o++)
            {
                TextDrawShowForPlayer(playerid, ObjectsLoadingTD[o]);
            }
            SetPVarInt(playerid, "LoadingObjects", 1);
            SetTimerEx("SafeLoadObjects", 3000, 0, "d", playerid);
           
            PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1377200", 321.139465, 1034.947753, 1098.914062, 120.0, 1);
        }
       
        // The Tableau Club (VIP ROOM)
        else if(IsPlayerInRangeOfPoint(playerid, 3.0,  307.904296, 1025.602294, 1098.540039))
        {
            if(GetPlayerCash(playerid) >= 100)
            {
                format(string, sizeof(string), "* %s has entered The Tableau VIP Room.", GetPlayerNameEx(playerid));
                ProxDetector(25.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
               
                GivePlayerCash(playerid, -100);
                GameTextForPlayer(playerid, "~r~-$100", 3000, 1);
               
                SetPlayerVirtualWorld(playerid, 363636);
                PlayerInfo[playerid][pVW] = 363636;
                SetPlayerInterior(playerid, 36);
                PlayerInfo[playerid][pInt] = 36;
                SetPlayerPos(playerid, 293.066436, 1029.785278, 1104.560058);
                SetPlayerFacingAngle(playerid, 352.47);
                SetCameraBehindPlayer(playerid);
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, " You do not have the cash for that.");
            }
        }
       
        // Santa Maria Surfer's Lounge
        else if(IsPlayerInRangeOfPoint(playerid, 3.0,  387.958374, -1870.688110, 7.835937))
        {
            format(string, sizeof(string), "* %s has entered Santa Maria Surfer's Lounge.", GetPlayerNameEx(playerid));
            ProxDetector(25.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
           
            SetPlayerVirtualWorld(playerid, 353535);
            PlayerInfo[playerid][pVW] = 353535;
            SetPlayerInterior(playerid, 35);
            PlayerInfo[playerid][pInt] = 35;
            SetPlayerPos(playerid, 271.742034, 1074.419677, 5096.750000);
            SetPlayerFacingAngle(playerid, 86.54);
            SetCameraBehindPlayer(playerid);
           
            TogglePlayerControllable(playerid, 0);
            for(new o = 0; o < 6; o++)
            {
                TextDrawShowForPlayer(playerid, ObjectsLoadingTD[o]);
            }
            SetPVarInt(playerid, "LoadingObjects", 1);
            SetTimerEx("SafeLoadObjects", 3000, 0, "d", playerid);
           
            PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=21585", 271.742034, 1074.419677, 5096.750000, 120.0, 1);
        }
       
        new vehicleid = GetPlayerVehicleID(playerid);
        new closestcar = GetClosestCar(playerid, vehicleid);
        if(IsPlayerInRangeOfVehicle(playerid, closestcar, 6.0) && GetVehicleModel(closestcar) == 519)
        {
            if(VehicleStatus{closestcar} == 1) return SendClientMessage(playerid, COLOR_WHITE, "You're not allowed to enter this Shamal as it's been damaged!");
            format(string, sizeof(string), "* %s enters the Shamal airplane as a passenger.", GetPlayerNameEx(playerid));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            SetPlayerPos(playerid, 2.509036, 23.118730, 1199.593750);
            SetPlayerFacingAngle(playerid, 82.14);
            SetCameraBehindPlayer(playerid);
            PlayerInfo[playerid][pVW] = closestcar;
            SetPlayerVirtualWorld(playerid, closestcar);
            PlayerInfo[playerid][pInt] = 1;
            SetPlayerInterior(playerid, 1);
            InsideShamal[playerid] = closestcar;
            SendClientMessage(playerid, COLOR_WHITE, "Type /exit near the door to exit the vehicle, or /window to look outside.");
           
            foreach(Player, x)
            {
                if(IsABoomboxNearby(2.509036, 23.118730, 1199.593750, x) < 150.0 && closestcar == BoomboxInfo[x][bbVW] && BoomboxInfo[x][bbInt] == 1)
                {
                    PlayAudioStreamForPlayer(playerid, VehicleRadioListing[BoomboxInfo[x][bbStation]-1][radiourl], BoomboxInfo[x][bbPosX], BoomboxInfo[x][bbPosY], BoomboxInfo[x][bbPosZ], 50.0, 1);
                }
            }
        }
    }
    return 1;
}
Reply
#4

The script would be a little bit messy because i want to add that for exit command too and maybe for car engine etc.. Why i cant recall the same function without getting this error ?
Reply
#5

Its just the way it works in pawn, you cant create the same function twice in one gamemode without getting the "symbol already defined" error.

The only way around it is to either rename the function (if it is a custom one) or merge them together (if it is a pre-defined one such as OnPlayerKeyStateChange()).

The only things I would suggest to you is to merge the functions together and to clean your script up a bit to make it more easier to read.
Reply
#6

Imma see others opinions ! thanks for the help bro'
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)