SA-MP Forums Archive
2 question 1 problem - 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: 2 question 1 problem (/showthread.php?tid=486862)



2 question 1 problem - anou1 - 10.01.2014

Hi,

Pastbin: http://pastebin.com/Pbd2n7vf


Question:

1)
How can I do to spawn a player, once he entered his password ?
But only when he login, not when he register.


2) If a player lost his password or something like this, how can I do to delete the previous and replace it with a new one in mysql table ?



Problem:


When I register for the first time and then I spawn, I'm not at the place I should be, I spawn at 0,0,0 I think.


Maybe a video will help

[ame]http://www.youtube.com/watch?v=ilZRL2yD8lY[/ame]


Re: 2 question 1 problem - offon - 10.01.2014

https://sampwiki.blast.hk/wiki/SetSpawnInfo
https://sampwiki.blast.hk/wiki/SpawnPlayer


Re: 2 question 1 problem - anou1 - 10.01.2014

Thank you problem solved for 1) question

I forgot to "SpawnPlayer(playerid);


AW: 2 question 1 problem - Nero_3D - 10.01.2014

For the second you just need a security question or something like that to reset the password if he entered it more than x times than just update the password in the mysql table


Re: 2 question 1 problem - anou1 - 10.01.2014

Thank you,

for my problem anyone got an idea ?


Re: 2 question 1 problem - anou1 - 11.01.2014

UP please


Re: 2 question 1 problem - Lidor124 - 11.01.2014

For your problem i think https://sampwiki.blast.hk/wiki/SetSpawnInfo also will help


Re: 2 question 1 problem - anou1 - 11.01.2014

I putted in below

Код:
case 2: //register dialog
        {
            if(!response) return Kick(playerid); //if they clicked Quit, we will kick them
            if(strlen(inputtext) < 6) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "S'enregistrer", "Ton mot de passe doit faire plus de 6 caractиres !", "S'enregistrer", "Quitter");
            //strlen checks a lenght of a string. so if player types their password that is lower than 6, we tell them; Your password must be at least 6 characters long!
            WP_Hash(pInfo[playerid][Password], 129, inputtext); //hashing inputtext
            mysql_format(mysql, query, sizeof(query), "INSERT INTO `joueurs` (`Username`, `Password`, `IP`, `Admin`, `VIP`, `Argent`, `posX` ,`posY`, `posZ`, `Interieur`, `World`, `Skin`) VALUES ('%e', '%s', '%s', 0, 0, 1000, 1527.5634, -1738.9218, 13.5469, 0, 0, 26)", Name[playerid], pInfo[playerid][Password], IP[playerid]);
            //Now let's create a new row and insert player's information in it
            mysql_tquery(mysql, query, "", "");
            //let's execute the query	
			SetSpawnInfo( playerid, 0, pInfo[playerid][Skin], pInfo[playerid][posX],pInfo[playerid][posY],pInfo[playerid][posZ], 0.0, 0, 0, 0, 0, 0, 0 );
        }

But it changed nothing, they player still spawn at 0,0,0 when he register and enter in the game for the first time.

Other ideas ?




My mysql log:

Код:
 mysql_format - connection: 1, len: 512, format: "INSERT INTO `joueurs` (`Username`, `Password`, `IP`, `Admin`, `VIP`, `Argent`, `posX` ,`posY`, `posZ`, `Interieur`, `World`, `Sk..."
[13:27:57] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO `joueurs` (`Username`, `Password`, `IP`, `Admin`, `V", callback: "(null)", format: "(null)"



Re: 2 question 1 problem - Lidor124 - 11.01.2014

SetSpawnInfo( playerid, 0, pInfo[playerid][Skin], pInfo[playerid][posX],pInfo[playerid][posY],pInfo[playerid][posZ]

the posX posY posZ did you make it save on the ini file of the user?


Re: 2 question 1 problem - anou1 - 11.01.2014

It saves in mysql database.



PS: When I register, when I enter the password, and don't click on spawn button.
If I go on my mysql database, I can see that the posX,Y and Z are good.




EDIT: Problem solved, thank you