Help with spawning
#1

Hello,

I'm developing a Zombie RP.

But I made something that if you register you can select a Shelter where you are safe from zombies.
All the register stuff works.

but now when you login, you get the menu on the bottem of the screen "<<<" ">>>" "Spawn"

I want them to spawn automaticly

pawn Код:
public OnPlayerLoginAttempt(playerid, password[])
{
    new string[128], Year, Month, Day, Minute, Hour, Second, Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, sizeof(Name));
    format(string, sizeof(string), "Accounts/%s.ini", Name);

    if(Player[playerid][LoginAttempts] == 3)
    {
        SendClientMessage(playerid, ADMINORANGE, "You have used your three attempts.");
        Kick(playerid);
    }

    getdate(Year, Month, Day);
    gettime(Hour, Minute, Second);

    if(fexist(string))
    {
        if(strcmp(dini_Get(string, "Password"), password, false) == 0)
        {
            Player[playerid][Authenticated] = 1;
            Player[playerid][Password] = dini_Get(string, "Password");
            Player[playerid][AdminLevel] = dini_Int(string, "AdminLevel");
            Player[playerid][LastX] = dini_Float(string, "LastX");
            Player[playerid][LastY] = dini_Float(string, "LastY");
            Player[playerid][LastZ] = dini_Float(string, "LastZ");
            Player[playerid][LastWorld] = dini_Int(string, "LastWorld");
            Player[playerid][LastInterior] = dini_Int(string, "LastInterior");
            Player[playerid][Health] = dini_Float(string, "Health");
            Player[playerid][Armour] = dini_Float(string, "Armour");
            Player[playerid][LastSkin] = dini_Int(string, "LastSkin");
            Player[playerid][Money] = dini_Int(string, "Money");
            Player[playerid][Banned] = dini_Int(string, "Banned");
            Player[playerid][Spawn] = dini_Int(string, "Spawn");
            Player[playerid][Shelter] = dini_Int(string, "Shelter");

            if(Player[playerid][Spawn] == 1)
            {
                SetSpawnInfo(playerid, 0, Player[playerid][LastSkin], Player[playerid][LastX], Player[playerid][LastY], Player[playerid][LastZ], 0, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);

                SetPlayerInterior(playerid, Player[playerid][LastInterior]);
                SetPlayerVirtualWorld(playerid, Player[playerid][LastWorld]);
            }
            else if(Player[playerid][Spawn] == 2)
            {
                if(Player[playerid][Shelter] == 1)
                {
                    SetSpawnInfo(playerid, 0, Player[playerid][LastSkin],2215.454833,-1147.475585,1025.796875, 0, 0, 0, 0, 0, 0, 0);
                    SetPlayerInterior(playerid, 15);
                    SpawnPlayer(playerid);
                }
                else if(Player[playerid][Shelter] == 2)
                {
                    SetSpawnInfo(playerid, 0, Player[playerid][LastSkin], 2496.049804,-1695.238159,1014.742187, 0, 0, 0, 0, 0, 0, 0);
                    SetPlayerInterior(playerid, 3);
                    SpawnPlayer(playerid);
                }
                else if(Player[playerid][Shelter] == 3)
                {
                    SetSpawnInfo(playerid, 0, Player[playerid][LastSkin], 2324.419921,-1145.568359,1050.710083, 0, 0, 0, 0, 0, 0, 0);
                    SetPlayerInterior(playerid, 12);
                    SpawnPlayer(playerid);
                }
                else if(Player[playerid][Shelter] == 4)
                {
                    SetSpawnInfo(playerid, 0, Player[playerid][LastSkin], 1710.433715,-1669.379272,20.225049, 0, 0, 0, 0, 0, 0, 0);
                    SetPlayerInterior(playerid, 18);
                    SpawnPlayer(playerid);
                }
            }
            new Flaw = floatround(Player[playerid][Health], floatround_ceil);
            SetPlayerHealth(playerid, Flaw);

            Flaw = floatround(Player[playerid][Armour], floatround_ceil);
            SetPlayerArmour(playerid, Flaw);

            GivePlayerMoney(playerid, Player[playerid][Money]);
            SetPlayerSkin(playerid, Player[playerid][LastSkin]);
        }
        else
        {
            new Sum;
            Sum = 3-Player[playerid][LoginAttempts];
            SendClientMessage(playerid, ADMINORANGE, "The password you have entered does not match your account. Please try again or use the forums.");
            Player[playerid][LoginAttempts]++;
            format(string, sizeof(string), "You have %d remaining login attempts, before you are auto-banned.", Sum);
            SendClientMessage(playerid, WHITE, string);
            ShowPlayerDialog(playerid, 3894, DIALOG_STYLE_PASSWORD, "Authentication", "Welcome back to Volcom Roleplay\n\nYou have an account, please enter your password to authenticate.", "Login", "Help");
            if(Player[playerid][LoginAttempts] == 3)
            {
                SendClientMessage(playerid, ADMINORANGE, "You have used your three attempts.");
                Kick(playerid);
            }

        }
    }
    else
    {
        SendClientMessage(playerid, WHITE, "You must register first.");
    }
    return 1;
}
You can change your spawn style with /changespawn

but my problem is about the spawning stuff..

Can someone help?
Reply
#2

Oke fixed so far, but now, It keeps setting the player to his LAST position. but with the Shelter's Interior id....

Any ideas how to fix?

pawn Код:
public OnPlayerLoginAttempt(playerid, password[])
{
    new string[128], Year, Month, Day, Minute, Hour, Second, Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, sizeof(Name));
    format(string, sizeof(string), "Accounts/%s.ini", Name);

    if(Player[playerid][LoginAttempts] == 3)
    {
        SendClientMessage(playerid, ADMINORANGE, "You have used your three attempts.");
        Kick(playerid);
    }

    getdate(Year, Month, Day);
    gettime(Hour, Minute, Second);

    if(fexist(string))
    {
        if(strcmp(dini_Get(string, "Password"), password, false) == 0)
        {
            Player[playerid][Authenticated] = 1;
            Player[playerid][Password] = dini_Get(string, "Password");
            Player[playerid][AdminLevel] = dini_Int(string, "AdminLevel");
            Player[playerid][LastX] = dini_Float(string, "LastX");
            Player[playerid][LastY] = dini_Float(string, "LastY");
            Player[playerid][LastZ] = dini_Float(string, "LastZ");
            Player[playerid][LastWorld] = dini_Int(string, "LastWorld");
            Player[playerid][LastInterior] = dini_Int(string, "LastInterior");
            Player[playerid][Health] = dini_Float(string, "Health");
            Player[playerid][Armour] = dini_Float(string, "Armour");
            Player[playerid][LastSkin] = dini_Int(string, "LastSkin");
            Player[playerid][Money] = dini_Int(string, "Money");
            Player[playerid][Banned] = dini_Int(string, "Banned");
            Player[playerid][Spawn] = dini_Int(string, "Spawn");
            Player[playerid][Shelter] = dini_Int(string, "Shelter");

            if(Player[playerid][Spawn] == 1)
            {
                SetPlayerPos(playerid, Player[playerid][LastX], Player[playerid][LastY], Player[playerid][LastZ]);
                SetPlayerInterior(playerid, Player[playerid][LastInterior]);
                SetPlayerVirtualWorld(playerid, Player[playerid][LastWorld]);
                SpawnPlayer(playerid);
                SetPlayerSkin(playerid, Player[playerid][LastSkin]);
            }
            else if(Player[playerid][Spawn] == 2)
            {
                if(Player[playerid][Shelter] == 1)
                {
                    SetPlayerPos(playerid, 2226.8325, -1183.8024, 1029.8043);
                    SetPlayerInterior(playerid, 15);
                    SpawnPlayer(playerid);
                    SetPlayerSkin(playerid, Player[playerid][LastSkin]);
                }
                else if(Player[playerid][Shelter] == 2)
                {
                    SetPlayerPos(playerid, 2492.3364, -1702.5139, 1018.3438);
                    SetPlayerInterior(playerid, 3);
                    SpawnPlayer(playerid);
                    SetPlayerSkin(playerid, Player[playerid][LastSkin]);
                }
                else if(Player[playerid][Shelter] == 3)
                {
                    SetPlayerPos(playerid, -2163.3225, 644.2694, 1057.5938);
                    SetPlayerInterior(playerid, 1);
                    SpawnPlayer(playerid);
                    SetPlayerSkin(playerid, Player[playerid][LastSkin]);
                }
                else if(Player[playerid][Shelter] == 4)
                {
                    SetPlayerPos(playerid, 772.2763,-22.1738,1000.5859);
                    SetPlayerInterior(playerid, 6);
                    SpawnPlayer(playerid);
                    SetPlayerSkin(playerid, Player[playerid][LastSkin]);
                }
            }
            new Flaw = floatround(Player[playerid][Health], floatround_ceil);
            SetPlayerHealth(playerid, Flaw);

            Flaw = floatround(Player[playerid][Armour], floatround_ceil);
            SetPlayerArmour(playerid, Flaw);

            GivePlayerMoney(playerid, Player[playerid][Money]);
            SetPlayerSkin(playerid, Player[playerid][LastSkin]);
        }
        else
        {
            new Sum;
            Sum = 3-Player[playerid][LoginAttempts];
            SendClientMessage(playerid, ADMINORANGE, "The password you have entered does not match your account. Please try again or use the forums.");
            Player[playerid][LoginAttempts]++;
            format(string, sizeof(string), "You have %d remaining login attempts, before you are auto-banned.", Sum);
            SendClientMessage(playerid, WHITE, string);
            ShowPlayerDialog(playerid, 3894, DIALOG_STYLE_PASSWORD, "Authentication", "Welcome back to Volcom Roleplay\n\nYou have an account, please enter your password to authenticate.", "Login", "Help");
            if(Player[playerid][LoginAttempts] == 3)
            {
                SendClientMessage(playerid, ADMINORANGE, "You have used your three attempts.");
                Kick(playerid);
            }

        }
    }
    else
    {
        SendClientMessage(playerid, WHITE, "You must register first.");
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)