SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 20/02/2011, 02:17 PM   #1
bartje01
High-roller
 
Join Date: Jan 2009
Posts: 1,419
Reputation: 6
Default Spawn on login

Hey guys. I've got a little problem. I want that once you log in you'll spawn automaticly.
But it bugs. When I spawn I can walk but the camera doesn't move.

pawn Code:
if (dialogid == Login)
    {
        new name[MAX_PLAYER_NAME], file[256];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        if(!response) return Kick(playerid);
        if (!strlen(inputtext)) return  ShowPlayerDialog(playerid, Login, DIALOG_STYLE_INPUT, "Welcome back", "Pleas fill in your password below", "Login", "Leave");
        new tmp;
        tmp = dini_Int(file, "Password");
        if(udb_hash(inputtext) != tmp) {
        SendClientMessage(playerid, COLOR_RED, "Wrong password");
        ShowPlayerDialog(playerid, Login, DIALOG_STYLE_INPUT, "Welcome back", "Pleas fill in your password below", "Login", "Leave");
        }
        else
        {
            logged[playerid] = 1;
            PlayerInfo[playerid][adminlevel] = dini_Int(file, "adminlevel");
            PlayerInfo[playerid][money] = dini_Int(file, "money");
            PlayerInfo[playerid][score] = dini_Int(file, "score");
            GivePlayerMoney(playerid, dini_Int(file, "money")-GetPlayerMoney(playerid));
            SetPlayerScore(playerid, dini_Int(file, "score")-GetPlayerScore(playerid));
            SendClientMessage(playerid,COLOR_RED, "Successfully logged in!");
            SpawnPlayer(playerid);
         
        }
    }
    return 0;
}
bartje01 is offline  
Old 20/02/2011, 02:47 PM   #2
!Phoenix!
Big Clucker
 
Join Date: Feb 2011
Location: 127.0.0.1 - Germany
Posts: 81
Reputation: 0
Default AW: Spawn on login

Anything else used before than
pawn Code:
public OnGameModeInit()
{
    AddPlayerClass();
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerCameraPos(); ()
    SetPlayerCameraLookAt();
}
to change camera etc.?
!Phoenix! is offline  
Old 20/02/2011, 03:01 PM   #3
rjjj
Guest
 
Posts: n/a
Default Re: Spawn on login

I think that it can solve your problem:

pawn Code:
if (dialogid == Login)
    {
        new name[MAX_PLAYER_NAME], file[256];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        if(!response) return Kick(playerid);
        if (!strlen(inputtext)) return  ShowPlayerDialog(playerid, Login, DIALOG_STYLE_INPUT, "Welcome back", "Pleas fill in your password below", "Login", "Leave");
        new tmp;
        tmp = dini_Int(file, "Password");
        if(udb_hash(inputtext) != tmp) {
        SendClientMessage(playerid, COLOR_RED, "Wrong password");
        ShowPlayerDialog(playerid, Login, DIALOG_STYLE_INPUT, "Welcome back", "Pleas fill in your password below", "Login", "Leave");
        }
        else
        {
            logged[playerid] = 1;
            PlayerInfo[playerid][adminlevel] = dini_Int(file, "adminlevel");
            PlayerInfo[playerid][money] = dini_Int(file, "money");
            PlayerInfo[playerid][score] = dini_Int(file, "score");
            GivePlayerMoney(playerid, (dini_Int(file, "money")-GetPlayerMoney(playerid)));
            SetPlayerScore(playerid, (dini_Int(file, "score")-GetPlayerScore(playerid)));
            SendClientMessage(playerid,COLOR_RED, "Successfully logged in!");
            TogglePlayerControllable(playerid, true);
            SetCameraBehindPlayer(playerid);
            SpawnPlayer(playerid);
            return 1;
        }
    }
    return 0;
}

I hope that i have helped
 
Old 20/02/2011, 03:29 PM   #4
!Phoenix!
Big Clucker
 
Join Date: Feb 2011
Location: 127.0.0.1 - Germany
Posts: 81
Reputation: 0
Default AW: Spawn on login

@rjj: Btw: Please label your changes next time so that we don't have to use a program to detect them all.
(Did so - return 1 is correct, but the other two additions should be unnecessary)
!Phoenix! is offline  
Old 20/02/2011, 04:29 PM   #5
bartje01
High-roller
 
Join Date: Jan 2009
Posts: 1,419
Reputation: 6
Default Re: Spawn on login

Thanks. But I fixed it with a timer
bartje01 is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
login Spawn RatHack Help Archive 1 07/07/2010 06:26 PM
how does i make auto login and login before spawn ? reddead15 Help Archive 7 03/05/2010 03:26 AM
Login before spawn cozza123456 Help Archive 10 26/03/2010 07:51 PM
Login before spawn lilstuh Help Archive 5 03/07/2009 10:56 PM
Help with login before spawn ? Mr_Finnigan Help Archive 8 04/06/2009 03:18 PM


All times are GMT. The time now is 12:56 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.