Exit interior help
#1

Hello when i exit the interior i spawn in some where else but i am suppose to be in lspd after exiting it
Please help me

here is my code:
pawn Код:
new Float:PrisonSpawn[4][4] =
{
{215.3656,110.1666,999.0156},
{223.6761,110.4839,999.0156},
{227.6406,110.6463,999.0156},
{215.3656,110.1666,999.0156}
};
pawn Код:
@Release(playerid);
@Release(playerid)
{
    new Time = GetPVarInt(playerid, "JailTime");
    if(!IsPlayerConnected(playerid))
        return 0;
   
    if(Time < 1)
    {
      SetPlayerInterior(playerid, 6);
      SetPlayerPos(playerid, 246.1763,86.3909,1003.6406);
      SetPlayerFacingAngle(playerid, 180.1451);
      return SendClientMessage(playerid,-1,"You're free");
    }
    new str[30];
    format(str, sizeof(str), "You will be released in: %d", Time);
    GameTextForPlayer(playerid, str, 2500, 3); // Change it if you want

    SetPVarInt(playerid, "JailTime", Time - 1); // Decrease the player's jail time
    SetTimerEx("@Release", 1000, false, "i", playerid);
    return 1;
}
pawn Код:
CMD:ar(playerid,params[])
{
    new targetid;
    new string[128];
    if(sscanf(params, "u", targetid))
    {
        SendClientMessage(playerid,COLOR_ERROR,"USAGE: /ar (Player Name/ID)");
        return 1;
    }
    if(gTeam[playerid] != Team_Cop)
    {
        SendClientMessage(playerid,COLOR_ERROR,"Only law enforcement can arrest wanted suspects.");
        return 1;
    }
    if(!IsPlayerConnected(targetid))
    {
        format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot arrest them.",targetid);
        SendClientMessage(playerid,COLOR_ERROR,string);
        return 1;
    }
    if(GetDistanceBetweenPlayers(playerid,targetid) > 4)
    {
        format(string,sizeof(string),"%s(%d) is too far away. You cannot reach him to arrest him.",GetName(targetid),targetid);
        SendClientMessage(playerid,COLOR_ERROR,string);
        return 1;
    }
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You cannot arrest a suspect while in a vehicle. Exit the vehicle first.");
        return 1;
    }
    if(GetPlayerState(targetid) == PLAYER_STATE_DRIVER || GetPlayerState(targetid) == PLAYER_STATE_PASSENGER)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You cannot arrest a suspect they are in a vehicle. Get them to exit the vehicle first.");
        return 1;
    }
    new pwl = GetPlayerWantedLevel(targetid);
    if(pwl == 0)
    {
      GivePlayerMoney(playerid, 3000);
      IncreaseScore(playerid, 1);
      IncreaseCoprank(playerid, 1);
      SetPVarInt(targetid, "JailTime", 45);
      SetPlayerInterior(targetid, 10);
      new rnd = random(sizeof(PrisonSpawn));
      SetPlayerPos(targetid, PrisonSpawn[rnd][0], PrisonSpawn[rnd][1], PrisonSpawn[rnd][2]);
      SendClientMessage(targetid, COLOR_GREY, "**LOS SANTOS PRISON**");
      SendClientMessage(targetid, COLOR_LIGHTBLUE, "[PRISON] You have been sent to prison. You will be released soon.");
      TogglePlayerControllable(targetid, 1);
      SetPlayerWantedLevel(targetid, 0);
      @Release(targetid);
      return 1;
    }
Images of the bug:
http://i39.tinypic.com/2ng762b.png
http://i41.tinypic.com/spx2rc.png


Help me please
Reply
#2

pawn Код:
SetPlayerPos(playerid, 246.1763,86.3909,1003.6406);
SetPlayerFacingAngle(playerid, 180.1451);

Change to:
pawn Код:
SetPlayerPos(playerid, 1554.7684, -1675.5216, 16.1953);
SetPlayerFacingAngle(playerd, 89.7591);
Reply
#3

Can you tell me how did you do the coordinates like how you found them
Reply
#4

Please tell me
Reply
#5

I logged into my server, went to LSPD and typed /save, then I went into My Documents/GTA San Andreas User Files/SAMP/savedpositions.txt

AddPlayerClass(2,1554.7684,-1675.5216,16.1953,89.7591,0,0,0,0,0,0); //

1554.7684,-1675.5216,16.1953,89.7591
shows the X, Y, Z, and A of the player. The other thing you can do is this:

I'm going to assume you have zcmd.
pawn Код:
CMD:mypos(playerid, params[])
    {
    new Float:X, Float:Y, Float:Z, Float:A, string[100];
    GetPlayerPos(playerid, X, Y, Z);
    GetPlayerFacingAngle(playerid, A);
    format(string, sizeof(string, "Position: %d, %d, %d, Angle: %d", X, Y, Z, A));
    SendClientMessage(playerid, -1, string);
    return 1;
    }
Reply
#6

Thanks
Reply
#7

No prob
Reply
#8

Can you find me the coords for some reason i do the same thing you tell me but when i exit i spawn in the same place

here is a pic where i want a player to spawn after he gets out of jail

Reply
#9

Can i get help with this please
Reply
#10

Can some give me the SetPlayerPos coords like in the pic i posted please
Because when i try to do it it give's me wrong coords
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)