Mysql Registrate
#1

Hello need help with sql registration system :

this is my registrate dialog :

Код:
if(dialogid == DIALOG_REGISTER) //REGISTRACIJA
	{
			if(!response) Kick(playerid);
			if(strlen(inputtext)>=5)
			{
			new query[300];
            //WP_Hash(PlayerInfo[playerid][Password], 129, inputtext); //hashing inputtext
            mysql_format(sqlconnect, query, sizeof(query), "INSERT INTO `accounts` (`Name`, `Password`, `IP`, `Admin`, `VIP`, `Money`, `posX` ,`posY`, `posZ`) VALUES ('%e', '%s', '%s', 0, 0, 0, 1788.6445,-1601.3077,13.5469)", Name[playerid], inputtext, IP[playerid]);
            mysql_tquery(sqlconnect, query, "OnAccountRegister", "i", playerid);
			
			
			}
			else
			{
			        //Slaptazodis per trumpas
				SendClientMessage(playerid,COLOR_RED,"Jusu Slaptazodis per trumpas ");
                ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Registracija","Iveskite slaptazodi:","Registruotis","Iseiti");
			}
When i registrate he dost give my any error or something do everything whats he needs to do excepts player position , when i complete registration and press spawn its doasnt put my at the location i put in mysql
but give some random location like on this picture :


this is my spawn, and disconnect call backs :

Код:
public OnPlayerSpawn(playerid)
{
    
    
    
	SetPlayerFacingAngle(playerid,	169.2070 );
	SetPlayerPos(playerid, PlayerInfo[playerid][posX], PlayerInfo[playerid][posZ], PlayerInfo[playerid][posZ]);
Код:
public OnPlayerDisconnect(playerid, reason)
{
    new query[128], Float:pos[3];
    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    mysql_format(sqlconnect, query, sizeof(query), "UPDATE `accounts` SET `Admin`=%d, `Vip`=%d, `Money`=%d, `posX`=%f, `posY`=%f, `posZ`=%f WHERE `ID`=%d",\
    PlayerInfo[playerid][Admin], PlayerInfo[playerid][Vip], PlayerInfo[playerid][Money], pos[0], pos[1], pos[2], PlayerInfo[playerid][ID]);
    mysql_tquery(sqlconnect, query, "", "");
    


	return 1;
}
those both are working aswell after i register then relog they give my position like i was before update is working but insert position not working or it insert wrong possition cord
this is how look my db after registration :


who can help my to make it work
Reply


Messages In This Thread
Mysql Registrate - by cyberlord - 22.12.2014, 12:07
Re: Mysql Registrate - by Vince - 22.12.2014, 12:22
Re: Mysql Registrate - by cyberlord - 22.12.2014, 12:25
Re: Mysql Registrate - by Vince - 22.12.2014, 12:29
Re: Mysql Registrate - by cyberlord - 22.12.2014, 12:31
Re: Mysql Registrate - by cyberlord - 22.12.2014, 13:49

Forum Jump:


Users browsing this thread: 3 Guest(s)