SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 20/05/2017, 12:02 PM   #11
Aly
Huge Clucker
 
Join Date: Oct 2012
Posts: 227
Reputation: 11
Default Re: Loading system failing

Would you try this?

PHP Code:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
DIALOG_REGISTER:
        {
            if(!
response)
                return 
Kick(playerid);
            else
            {
                if(!
strlen(inputtext))
                    return 
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT"Registering...","You've entered an invalid password.\nEnter a new password to create a new account.","Register","Exit");
                
PlayerInfo[playerid][pPass] = udb_hash(inputtext);
                
/*
                Code to init your variables like:
                PlayerInfo[playerid][Admin] = 0;
                Just if it's needed
                */
                
SaveAccountStats(playerid); //Saves the stats from pInfo enum
                
SaveAccountCars(playerid); //Saves the account's cars stats from CarInfo enum

                
ShowPlayerDialog(playeridDIALOG_SEXDIALOG_STYLE_MSGBOX"- Sex -","Put your gender","Male","Female");
            }
        }
        case 
DIALOG_LOGIN:
        {
            if(!
response)
                return 
Kick(playerid);
            else
            {
                if(!
strlen(inputtext))
                    return 
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD"Server - Login""Wrong password\nTry again!""Login""Exit");
                if(
PlayerInfo[playerid][pPass] == udb_hash(inputtext))
                {
                    
GivePlayerMoney(playeridPlayerInfo[playerid][Cartera]);
                    
SetPlayerScore(playeridPlayerInfo[playerid][Nivel]);
                    
StopAudioStreamForPlayer(playerid);
                    
SetSpawnInfo(playerid0PlayerInfo[playerid][Skin], PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z], 1.0, -1, -1, -1, -1, -1, -1);
                    
TogglePlayerSpectating(playeridfalse);
                    
PlayerInfo[playerid][logged] = 1;
                    
SpawnPlayer(playerid);
                }
                else
                    return 
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD"Server - Login""Wrong password\nTry again!""Login""Exit");
            }
        }
    }
    return 
1;
}

public 
OnPlayerSpawn(playerid)
{
    if(
PlayerInfo[playerid][pPos_x] = 0.0)
        
SetPlayerPos(playerid1271.3654,181.0756,19.4705);
    else
        
SetPlayerPos(playeridPlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z]);
    
SetCameraBehindPlayer(playerid);
    
SetPlayerSkin(playeridPlayerInfo[playerid][Skin]);
    
SetPlayerHealth(playerid99.9);
    
SetTimerEx("payday"60000false"d"playerid);
    return 
1;

Aly is offline   Reply With Quote
Old 20/05/2017, 12:33 PM   #12
Antenastyle
Big Clucker
 
Join Date: Apr 2017
Posts: 67
Reputation: 0
Default Re: Loading system failing

Quote:
Originally Posted by Aly View Post
Would you try this?

PHP Code:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
DIALOG_REGISTER:
        {
            if(!
response)
                return 
Kick(playerid);
            else
            {
                if(!
strlen(inputtext))
                    return 
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT"Registering...","You've entered an invalid password.\nEnter a new password to create a new account.","Register","Exit");
                
PlayerInfo[playerid][pPass] = udb_hash(inputtext);
                
/*
                Code to init your variables like:
                PlayerInfo[playerid][Admin] = 0;
                Just if it's needed
                */
                
SaveAccountStats(playerid); //Saves the stats from pInfo enum
                
SaveAccountCars(playerid); //Saves the account's cars stats from CarInfo enum

                
ShowPlayerDialog(playeridDIALOG_SEXDIALOG_STYLE_MSGBOX"- Sex -","Put your gender","Male","Female");
            }
        }
        case 
DIALOG_LOGIN:
        {
            if(!
response)
                return 
Kick(playerid);
            else
            {
                if(!
strlen(inputtext))
                    return 
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD"Server - Login""Wrong password\nTry again!""Login""Exit");
                if(
PlayerInfo[playerid][pPass] == udb_hash(inputtext))
                {
                    
GivePlayerMoney(playeridPlayerInfo[playerid][Cartera]);
                    
SetPlayerScore(playeridPlayerInfo[playerid][Nivel]);
                    
StopAudioStreamForPlayer(playerid);
                    
SetSpawnInfo(playerid0PlayerInfo[playerid][Skin], PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z], 1.0, -1, -1, -1, -1, -1, -1);
                    
TogglePlayerSpectating(playeridfalse);
                    
PlayerInfo[playerid][logged] = 1;
                    
SpawnPlayer(playerid);
                }
                else
                    return 
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD"Server - Login""Wrong password\nTry again!""Login""Exit");
            }
        }
    }
    return 
1;
}

public 
OnPlayerSpawn(playerid)
{
    if(
PlayerInfo[playerid][pPos_x] = 0.0)
        
SetPlayerPos(playerid1271.3654,181.0756,19.4705);
    else
        
SetPlayerPos(playeridPlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z]);
    
SetCameraBehindPlayer(playerid);
    
SetPlayerSkin(playeridPlayerInfo[playerid][Skin]);
    
SetPlayerHealth(playerid99.9);
    
SetTimerEx("payday"60000false"d"playerid);
    return 
1;

Not working
Antenastyle is offline   Reply With Quote
Old 20/05/2017, 12:37 PM   #13
Aly
Huge Clucker
 
Join Date: Oct 2012
Posts: 227
Reputation: 11
Default Re: Loading system failing

Try to put some printf inside the loading function and see if the money and skin are getting loaded properly.
Aly is offline   Reply With Quote
Old 20/05/2017, 06:08 PM   #14
Antenastyle
Big Clucker
 
Join Date: Apr 2017
Posts: 67
Reputation: 0
Default Re: Loading system failing

Quote:
Originally Posted by Aly View Post
Try to put some printf inside the loading function and see if the money and skin are getting loaded properly.
Yeah, it gives the money, but when the DIALOG_LOGIN appears, automatically, the value of money and skin is set to 0
Antenastyle is offline   Reply With Quote
Old 20/05/2017, 06:48 PM   #15
Aly
Huge Clucker
 
Join Date: Oct 2012
Posts: 227
Reputation: 11
Default Re: Loading system failing

You should check to see where you set those values to 0 and make sure it doesn't happen after you load them.
Aly is offline   Reply With Quote
Old 22/05/2017, 05:36 PM   #16
Antenastyle
Big Clucker
 
Join Date: Apr 2017
Posts: 67
Reputation: 0
Default Re: Loading system failing

Quote:
Originally Posted by Aly View Post
You should check to see where you set those values to 0 and make sure it doesn't happen after you load them.
I've solved that, I just made a timer and everything was working fine. Again, thank you a looooot.
Antenastyle is offline   Reply With Quote
Reply

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
Loading System JessThompson Scripting Help 19 06/03/2017 04:54 PM
Toy System (Not Loading Properly) +Rep Phil_Cutcliffe Scripting Help 19 12/03/2014 03:57 PM
Register System Failing??? Tass007 Scripting Help 0 13/06/2013 05:09 AM
My trouble with loading system wmt Scripting Help 3 28/05/2012 03:56 PM
Loading system wmt Scripting Help 8 27/05/2012 05:36 PM


All times are GMT. The time now is 11:11 AM.


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