Help is needed!
#1

Hello guys!
I have recently downloaded the 'Prison Roleplay [EDIT]' gamemode which was posted by Naruto_Emilio.

I have a terrible bug in it, once i create a cell using the command '/createcell' and i try to go inside the cell it teleports me into the sky and i just fall to my death.

I am not sure if it should teleport you inside the cell or to a interior, but if anyone could help me find out how to make it that it would teleport you at least into the cell (Behind the bars)?

Also, if anyone could help me make the same thing to exit the cell from behind bars that would be great.

The full gamemode could be found here (CLICK ME).
Thanks, Xsyiaris.
Reply
#2

I think i have found something that can help to understand where it teleports you.

This is inside the gamemode code:
Код:
public LoadCells()
{
    printf("Checkpoints Loaded, Loading Cells...");
    for(new c = 0; c < MAX_CELLS; c++)
    {
		new CellFile[20];
        format(CellFile, 20, "Cells/Cell %d.ini", c);
        if(!fexist(CellFile)) return 0;
        if(INI_Open(CellFile))
	    {
		   new str[128];
           CellStat[c][CellPrice] = INI_ReadInt("Price");
           INI_ReadString(CellStat[c][CellOwner],"Owner", 60);
           CellStat[c][Owned] = INI_ReadInt("Owned");

           CellStat[c][VW] = INI_ReadInt("VW");
           CellStat[c][Locked] = INI_ReadInt("Locked");

           CellStat[c][ExteriorX] = INI_ReadFloat("ExteriorX");
           CellStat[c][ExteriorY] = INI_ReadFloat("ExteriorY");
           CellStat[c][ExteriorZ] = INI_ReadFloat("ExteriorZ");
           CellStat[c][InteriorX] = INI_ReadFloat("InteriorX");
           CellStat[c][InteriorY] = INI_ReadFloat("InteriorY");
           CellStat[c][InteriorZ] = INI_ReadFloat("InteriorZ");

           CellStat[c][CellLevel] = INI_ReadInt("Level");
           CellStat[c][CellPot] = INI_ReadInt("Pot");
           CellStat[c][CellCrack] = INI_ReadInt("Crack");
           CellStat[c][CellWeap1] = INI_ReadInt("Weap1");
           CellStat[c][CellWeap2] = INI_ReadInt("Weap2");

           if(CellStat[c][Owned] == 1)
		   {
               format(str, sizeof(str), "Cell ID %d\nOwner: %s", c, CellStat[c][CellOwner]);
               CellStat[c][TextLabel] = Create3DTextLabel(str, RED, CellStat[c][ExteriorX], CellStat[c][ExteriorY], CellStat[c][ExteriorZ] + 0.75, 1.0, 0, 0);
               CellStat[c][PickupID] = CreateDynamicPickup(1272, 23, CellStat[c][ExteriorX], CellStat[c][ExteriorY], CellStat[c][ExteriorZ], 0, -1, -1, 100.0);
           }
		   else
           {
               format(str, sizeof(str), "Cell ID %d\nOwner: %s\nThis Cell is available for $%d.", c, CellStat[c][CellOwner], CellStat[c][CellPrice]);
               CellStat[c][TextLabel] = Create3DTextLabel(str, RED, CellStat[c][ExteriorX], CellStat[c][ExteriorY], CellStat[c][ExteriorZ] + 0.75, 1.0, 0, 0);
               CellStat[c][PickupID] = CreateDynamicPickup(1273, 23, CellStat[c][ExteriorX], CellStat[c][ExteriorY], CellStat[c][ExteriorZ], 0, -1, -1, 100.0);
           }

           INI_Save();
           INI_Close();
           Server[LoadedCells]++;
        }
    }
	return 1;
}
And this is the Cell0 file that gets created upon creating a cell via the command stated above, it gets a number near to decide the cell ID.

Код:
Price=100
Owner=Nobody
Owned=0
VW=0
Locked=1
ExteriorX=1817.5555
ExteriorY=-1562.5048
ExteriorZ=5700.4287
InteriorX=1815.8555
InteriorY=-1562.5048
InteriorZ=5700.4287
Level=0
Pot=0
Crack=0
Weap1=0
Weap2=0
This is the cell location as it appear in /save.
Код:
AddPlayerClass(271,1817.4766,-1557.7900,5700.4287,269.9839,0,0,0,0,0,0); // Cell 1
Please! I need help pronto!
Reply
#3

Did you check if Interior XYZ's co-ordinations is actually not on top of the sky?
Reply
#4

Quote:
Originally Posted by Sublime
Посмотреть сообщение
Did you check if Interior XYZ's co-ordinations is actually not on top of the sky?
If you check my second post you would see the correct information needed for the cell location.

Edit:
I am trying now to add 1 more Y to see if its maybe caused by me falling through the floor. (The usual falling through bug)

Edit 2:
Not working yet, its like it sends me to a random place.
Reply
#5

Ok i have found the problem, can anyone tell me how to fix it though?
I am not really sure why it teleports me to a weird place, that's the code.

Код:
GetPlayerFacingAngle(playerid, pAng);
		    if(IsPlayerInRangeOfPoint(playerid, 1.0, CellStat[c][ExteriorX], CellStat[c][ExteriorY], CellStat[c][ExteriorZ]) && GetPlayerVirtualWorld(playerid) == 0)
	    	{
		    	if(CellStat[c][Locked] == 0)
		    	{
			        SetPlayerPos(playerid, floatsin(-pAng, degrees) * 0.5, floatcos(pAng, degrees) * 0.5 , (CellStat[c][InteriorZ]*2)+0.025);
		   	        SetPlayerInterior(playerid, 0);
			        SetCameraBehindPlayer(playerid);
			        SetPlayerVirtualWorld(playerid, 0);
			        TogglePlayerControllable(playerid, 0);
	                SetTimerEx("LoadingObjects", 1000, false, "d", playerid);
	            }
	            else return GameTextForPlayer(playerid, "~r~ Locked", 3000, 4);
	        }
	        else if(IsPlayerInRangeOfPoint(playerid, 1.0, CellStat[c][InteriorX], CellStat[c][InteriorY], CellStat[c][InteriorZ]) && GetPlayerVirtualWorld(playerid) == 0)
	    	{
	     		SetPlayerPos(playerid, floatsin(-pAng, degrees) * 0.5, floatcos(pAng, degrees) * 0.5 , (CellStat[c][ExteriorZ]*2)+0.025);
		   	    SetPlayerInterior(playerid, 0);
			    SetCameraBehindPlayer(playerid);
			    SetPlayerVirtualWorld(playerid, 0);
			    TogglePlayerControllable(playerid, 0);
	            SetTimerEx("LoadingObjects", 1000, false, "d", playerid);
	        }
        }
I have marked the line that i think makes the problem.
Reply
#6

Wrong :
Код:
for(new c = 0; c < MAX_CELLS; c++)
        {
	        new
	                Float:pAng
	        ;
	        GetPlayerFacingAngle(playerid, pAng);
		    if(IsPlayerInRangeOfPoint(playerid, 1.0, CellStat[c][ExteriorX], CellStat[c][ExteriorY], CellStat[c][ExteriorZ]) && GetPlayerVirtualWorld(playerid) == 0)
	    	{
		    	if(CellStat[c][Locked] == 0)
		    	{
			        SetPlayerPos(playerid, CellStat[c][InteriorX], CellStat[c][InteriorY], (CellStat[c][InteriorZ]*2)+0.025);
		   	        SetPlayerInterior(playerid, 0);
			        SetCameraBehindPlayer(playerid);
			        SetPlayerVirtualWorld(playerid, 0);
			        TogglePlayerControllable(playerid, 0);
	                SetTimerEx("LoadingObjects", 1000, false, "d", playerid);
	            }
	            else return GameTextForPlayer(playerid, "~r~ Locked", 3000, 4);
	        }
	        else if(IsPlayerInRangeOfPoint(playerid, 1.0, CellStat[c][InteriorX], CellStat[c][InteriorY], CellStat[c][InteriorZ]) && GetPlayerVirtualWorld(playerid) == 0)
	    	{
	     		SetPlayerPos(playerid, floatsin(-pAng, degrees) * 0.5, floatcos(pAng, degrees) * 0.5 , (CellStat[c][ExteriorZ]*2)+0.025);
		   	    SetPlayerInterior(playerid, 0);
			    SetCameraBehindPlayer(playerid);
			    SetPlayerVirtualWorld(playerid, 0);
			    TogglePlayerControllable(playerid, 0);
	            SetTimerEx("LoadingObjects", 1000, false, "d", playerid);
	        }
        }
Right :
Код:
	for(new c = 0; c < MAX_CELLS; c++)
        {
	        new
	                Float:pAng
	        ;
	        GetPlayerFacingAngle(playerid, pAng);
		    if(IsPlayerInRangeOfPoint(playerid, 1.0, CellStat[c][ExteriorX], CellStat[c][ExteriorY], CellStat[c][ExteriorZ]) && GetPlayerVirtualWorld(playerid) == 0)
	    	{
		    	if(CellStat[c][Locked] == 0)
		    	{
			        SetPlayerPos(playerid, CellStat[c][InteriorX], CellStat[c][InteriorY], CellStat[c][InteriorZ]);
		   	        SetPlayerInterior(playerid, 0); // 
			        SetCameraBehindPlayer(playerid);
			        SetPlayerVirtualWorld(playerid, 0);
			        TogglePlayerControllable(playerid, 0);
	                SetTimerEx("LoadingObjects", 1000, false, "d", playerid);
	            }
	            else return GameTextForPlayer(playerid, "~r~ Locked", 3000, 4);
	        }
	        else if(IsPlayerInRangeOfPoint(playerid, 1.0, CellStat[c][InteriorX], CellStat[c][InteriorY], CellStat[c][InteriorZ]) && GetPlayerVirtualWorld(playerid) == 0)
	    	{
	     		SetPlayerPos(playerid, CellStat[c][ExteriorX], CellStat[c][ExteriorY], CellStat[c][ExteriorZ]);
		   	    SetPlayerInterior(playerid, 0);
			    SetCameraBehindPlayer(playerid);
			    SetPlayerVirtualWorld(playerid, 0);
			    TogglePlayerControllable(playerid, 0);
	            SetTimerEx("LoadingObjects", 1000, false, "d", playerid);
	        }
        }
this script is outdated and have alot bug
Reply
#7

Quote:
Originally Posted by rickisme
Посмотреть сообщение
Wrong :
Код:
for(new c = 0; c < MAX_CELLS; c++)
        {
	        new
	                Float:pAng
	        ;
	        GetPlayerFacingAngle(playerid, pAng);
		    if(IsPlayerInRangeOfPoint(playerid, 1.0, CellStat[c][ExteriorX], CellStat[c][ExteriorY], CellStat[c][ExteriorZ]) && GetPlayerVirtualWorld(playerid) == 0)
	    	{
		    	if(CellStat[c][Locked] == 0)
		    	{
			        SetPlayerPos(playerid, CellStat[c][InteriorX], CellStat[c][InteriorY], (CellStat[c][InteriorZ]*2)+0.025);
		   	        SetPlayerInterior(playerid, 0);
			        SetCameraBehindPlayer(playerid);
			        SetPlayerVirtualWorld(playerid, 0);
			        TogglePlayerControllable(playerid, 0);
	                SetTimerEx("LoadingObjects", 1000, false, "d", playerid);
	            }
	            else return GameTextForPlayer(playerid, "~r~ Locked", 3000, 4);
	        }
	        else if(IsPlayerInRangeOfPoint(playerid, 1.0, CellStat[c][InteriorX], CellStat[c][InteriorY], CellStat[c][InteriorZ]) && GetPlayerVirtualWorld(playerid) == 0)
	    	{
	     		SetPlayerPos(playerid, floatsin(-pAng, degrees) * 0.5, floatcos(pAng, degrees) * 0.5 , (CellStat[c][ExteriorZ]*2)+0.025);
		   	    SetPlayerInterior(playerid, 0);
			    SetCameraBehindPlayer(playerid);
			    SetPlayerVirtualWorld(playerid, 0);
			    TogglePlayerControllable(playerid, 0);
	            SetTimerEx("LoadingObjects", 1000, false, "d", playerid);
	        }
        }
Right :
Код:
	for(new c = 0; c < MAX_CELLS; c++)
        {
	        new
	                Float:pAng
	        ;
	        GetPlayerFacingAngle(playerid, pAng);
		    if(IsPlayerInRangeOfPoint(playerid, 1.0, CellStat[c][ExteriorX], CellStat[c][ExteriorY], CellStat[c][ExteriorZ]) && GetPlayerVirtualWorld(playerid) == 0)
	    	{
		    	if(CellStat[c][Locked] == 0)
		    	{
			        SetPlayerPos(playerid, CellStat[c][InteriorX], CellStat[c][InteriorY], CellStat[c][InteriorZ]);
		   	        SetPlayerInterior(playerid, 0); // 
			        SetCameraBehindPlayer(playerid);
			        SetPlayerVirtualWorld(playerid, 0);
			        TogglePlayerControllable(playerid, 0);
	                SetTimerEx("LoadingObjects", 1000, false, "d", playerid);
	            }
	            else return GameTextForPlayer(playerid, "~r~ Locked", 3000, 4);
	        }
	        else if(IsPlayerInRangeOfPoint(playerid, 1.0, CellStat[c][InteriorX], CellStat[c][InteriorY], CellStat[c][InteriorZ]) && GetPlayerVirtualWorld(playerid) == 0)
	    	{
	     		SetPlayerPos(playerid, CellStat[c][ExteriorX], CellStat[c][ExteriorY], CellStat[c][ExteriorZ]);
		   	    SetPlayerInterior(playerid, 0);
			    SetCameraBehindPlayer(playerid);
			    SetPlayerVirtualWorld(playerid, 0);
			    TogglePlayerControllable(playerid, 0);
	            SetTimerEx("LoadingObjects", 1000, false, "d", playerid);
	        }
        }
this script is outdated and have alot bug
Thanks going to test it tommorow!
I will let you know if its working!
MUCH LOVE MAN! APPRECIATE!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)