SA-MP Forums Archive
Spawn issue - I spawn at Blueberry after registering - 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: Spawn issue - I spawn at Blueberry after registering (/showthread.php?tid=515389)



Spawn issue - I spawn at Blueberry after registering - AndySedeyn - 25.05.2014

I have an issue with my spawn location. However, it works in another script.

So, the thing is everything during the registration process goes good but when I choose my skin it spawns me in Blueberry. (Skin selection is the last part of the registration process) It should spawn me at the LS airport.

Skin Dialog
pawn Код:
if(dialogid == DIALOG_SKIN)
        {
            if(response)
            {
                new skin = strval(inputtext);
                if(skin < 0 || skin > 299)
                {
                    ShowPlayerDialog(playerid, DIALOG_SKIN, DIALOG_STYLE_INPUT, "Skin Selection", "{FFFFFF}Select your skin.\n\n{FF0000}Invalid skin selected!", "Submit", "Quit");
                }
                else if(skin == 0 || skin == 1 || skin == 2 || skin == 8 || skin == 42 || skin == 50 || skin == 71 || skin == 165 || skin == 166 || skin == 240 || skin == 264 || skin == 265 || skin == 266 || skin == 267 || skin == 274 || skin == 275 || skin == 276 || skin == 277 || skin == 278 || skin == 279 || skin == 280 || skin == 281 || skin == 282 || skin == 283 || skin == 284 || skin == 285 || skin == 286 || skin == 287 || skin == 288)
                {  
                    ShowPlayerDialog(playerid, DIALOG_SKIN, DIALOG_STYLE_INPUT, "Skin Selection", "{FFFFFF}Select your skin.\n\n{FF0000}You may not use that skin!", "Submit", "Quit");
                }
                else
                {
                    new string[54];
                    pInfo[playerid][pSkin] = strval(inputtext);
                    format(string, sizeof(string), "* [SERVER]: {FFFFFF}You've set your character's skin to %d", pInfo[playerid][pSkin]);
                    SendClientMessage(playerid, COLOR_WHITE, string);
                    TogglePlayerSpectating(playerid, 0);
                    TogglePlayerControllable(playerid, 1);
                    SetSpawnInfo(playerid, 0, pInfo[playerid][pSkin], 1685.8979, -2330.5691, -2.6797, 360, 0, 0, 0, 0, 0, 0);
                    SpawnPlayer(playerid);
                    ResetPlayerWeapons(playerid);
                    SetPlayerInterior(playerid,0);
                    SetPlayerVirtualWorld(playerid, 0);
                    pInfo[playerid][pHealth] = 100;
                    SetPlayerScore(playerid, 1);
                    SetPlayerColor(playerid, TRANSPARENT_WHITE);
                    GivePlayerCash(playerid, 0);
                    SetCameraBehindPlayer(playerid);
                    pInfo[playerid][pInt] = 0;
                    pInfo[playerid][pVW] = 0;
                    pInfo[playerid][pLevel] = 1;
                    format(tmp2, sizeof(tmp2), "~g~Welcome ~n~~w~   %s", GetName(playerid));
                    GameTextForPlayer(playerid, tmp2, 5000, 1);
                    gPlayerLogged[playerid] = 1;
                    return 1;          
                }
            }
            if(!response)
            {
                format(qstring, sizeof(qstring), "* [AdmCMD]: You have chosen to 'Quit', you're always welcome to come back!");
                SCM(playerid, COLOR_LIGHTRED, qstring);
                SetTimerEx("kickbugfix", 1000, false, "i", playerid);
                if(fexist(UserPath(playerid)))
                {
                    fremove(UserPath(playerid));
                }          
            }
        }
OnPlayerRequestClass
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetSpawnInfo(playerid, 0, pInfo[playerid][pSkin], 1685.8979/*X*/, -2330.5691/*Y*/, -2.6797/*Z*/, 360, 0, 0, 0, 0, 0, 0);
    SpawnPlayer(playerid);
    return 1;
}
OnPlayerSpawn
pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerSkin(playerid, pInfo[playerid][pSkin]);
    SetPlayerPos(playerid, pInfo[playerid][pLastX], pInfo[playerid][pLastY], pInfo[playerid][pLastZ]);
    SetPlayerFacingAngle(playerid, 360.0);
    return 1;
}
OnPlayerRequestSpawn (Changed it to return 0
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    return 0;
}
Thanks in advance!


Re: Spawn issue - I spawn at Blueberry after registering - erikhenri - 25.05.2014

Add this to your OnGameModeInit

Код:
AddPlayerClass(skin, posx, posy, posz, 0, 0, 0, 0, 0, 0);



Re: Spawn issue - I spawn at Blueberry after registering - AndySedeyn - 25.05.2014

Quote:
Originally Posted by erikhenri
Посмотреть сообщение
Add this to your OnGameModeInit

Код:
AddPlayerClass(skin, posx, posy, posz, 0, 0, 0, 0, 0, 0);
I don't have that in my other gamemode. It all works good there though.


Re: Spawn issue - I spawn at Blueberry after registering - erikhenri - 25.05.2014

I dont know, did you try it anyways ? It should work..


Re: Spawn issue - I spawn at Blueberry after registering - MacT - 25.05.2014

Quote:
Originally Posted by erikhenri
Посмотреть сообщение
Add this to your OnGameModeInit

Код:
AddPlayerClass(skin, posx, posy, posz, 0, 0, 0, 0, 0, 0);
He need location where player get spawned not the class.


Re: Spawn issue - I spawn at Blueberry after registering - AndySedeyn - 25.05.2014

Quote:
Originally Posted by erikhenri
Посмотреть сообщение
I dont know, did you try it anyways ? It should work..
It's not the skin which is the problem. It's the spawn location which is either bugged or I'm missing something.
I removed the skin selection so I don't see much sense in that.


Re: Spawn issue - I spawn at Blueberry after registering - t0 - 25.05.2014

well,you can solve it easily by :
when you spawn in blueberry,get the coordinates that you have spawned at exactly,just spawn and dont move,then search for it in the gamemode,and change it,thats all


Re: Spawn issue - I spawn at Blueberry after registering - MacT - 25.05.2014

Quote:
Originally Posted by Bible
Посмотреть сообщение
I don't have that in my other gamemode. It all works good there though.
Haave you included enums to this gamemode/filterscript ? If not try adding them


Re: Spawn issue - I spawn at Blueberry after registering - AndySedeyn - 25.05.2014

Quote:
Originally Posted by t0
Посмотреть сообщение
well,you can solve it easily by :
when you spawn in blueberry,get the coordinates that you have spawned at exactly,just spawn and dont move,then search for it in the gamemode,and change it,thats all
You're kidding me, right?
The spawn location is supposed to be at the LS airport, not blueberry.
And by all means I've defined the spawn location many times in the script and none of them says that the spawn location should be in Blueberry. (I spawn under the map and then land in Blueberry)

Quote:
Originally Posted by MacT
Посмотреть сообщение
Haave you included enums to this gamemode/filterscript ? If not try adding them
Of course there are enums.

This is a part of the enum.
pawn Код:
enum PlayerInfo
{
    Float:pFacingAngle,
    Float:pHealth,
    Float:pArmour,
    Float:pLastX,
    Float:pLastY,
    Float:pLastZ,  
}



AW: Spawn issue - I spawn at Blueberry after registering - Macronix - 25.05.2014

You need to define pLastX, pLastY and pLastZ when you pick a skin
so for example playerInfo[playerid][pLastX] = 2453.34; or something