My Position Resets [Help!]
#9

Quote:
Originally Posted by RedFusion
Посмотреть сообщение
Try again, edited my code
Nope

Replaced

Код:
/*Credits to Dracoblue*/
stock udb_hash(buf[]) {
	new length=strlen(buf);
    new s1 = 1;
    new s2 = 0;
    new n;
    for (n=0; n<length; n++)
    {
       s1 = (s1 + buf[n]) % 65521;
       s2 = (s2 + s1)     % 65521;
    }
    return (s2 << 16) + s1;
}
public OnPlayerConnect(playerid)
{
	if(fexist(UserPath(playerid)))
	{
		INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  		ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
	}
	else
	{
 		ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
	}
	return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_Close(File);

                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Welcome to OrbzGaming! Please RELOG to join the rest of the world!","Ok","");
			}
        }
with

Код:
{
    pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths,
    Float:pX,
    Float:pY,
    Float:pZ,
    Float:pZr
}

new PlayerInfo[MAX_PLAYERS][pInfo];
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
        INI_Int("Password",PlayerInfo[playerid][pPass]);
        INI_Int("Cash",PlayerInfo[playerid][pCash]);
        INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
        INI_Int("Kills",PlayerInfo[playerid][pKills]);
        INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
        INI_Float("XPos",PlayerInfo[playerid][pX]);
        INI_Float("YPos",PlayerInfo[playerid][pY]);
        INI_Float("ZPos",PlayerInfo[playerid][pZ]);
        INI_Float("Angle",PlayerInfo[playerid][pZr]);
        return 1;
}
public OnPlayerSpawn(playerid)
{
 SetPlayerPos(playerid,PlayerInfo[playerid][pX],PlayerInfo[playerid][pY],PlayerInfo[playerid][pZ]);
 SetPlayerFacingAngle(playerid,PlayerInfo[playerid][pZr]);
 SetCameraBehindPlayer(playerid);
 return 1;
}

public OnPlayerDeath(playerid)
{
 PlayerInfo[playerid][pX] = 0;//Regular Spawnpoint (X)
 PlayerInfo[playerid][pY] = 0;//Regular Spawnpoint (Y)
 PlayerInfo[playerid][pZ] = 0;//Regular Spawnpoint (Z)
 PlayerInfo[playerid][pZr] = 0;//Regular Spawnpoint (Angle)
 PlayerInfo[killerid][pKills]++;
 PlayerInfo[playerid][pDeaths]++;
 return 1;
}

public OnPlayerDisconnect(playerid,reason)
{
 switch(GetPlayerState(playerid)){ case 1..6:
 {
  GetPlayerPos(playerid,PlayerInfo[playerid][pX],PlayerInfo[playerid][pY],PlayerInfo[playerid][pZ]);
  GetPlayerFacingAngle(playerid,PlayerInfo[playerid][pZr]);
 }}
 new INI:File = INI_Open(UserPath(playerid));
 INI_SetTag(File,"data");
 INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
 INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
 INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
 INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
 INI_WriteFloat(File,"XPos",PlayerInfo[playerid][pX]);
 INI_WriteFloat(File,"YPos",PlayerInfo[playerid][pY]);
 INI_WriteFloat(File,"ZPos,PlayerInfo[playerid][pZ]);
 INI_WriteFloat(File,"Angle",PlayerInfo[playerid][pZr]);
 INI_Close(File);
 return 1;
}

        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
					ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
    return 1;
}
Got

Код:
C:\Users\Cody\Desktop\OrbzGaming\SAMP\Server\gamemodes\grandlarc.pwn(66) : error 017: undefined symbol "killerid"
C:\Users\Cody\Desktop\OrbzGaming\SAMP\Server\gamemodes\grandlarc.pwn(78) : error 017: undefined symbol "UserPath"
C:\Users\Cody\Desktop\OrbzGaming\SAMP\Server\gamemodes\grandlarc.pwn(86) : error 037: invalid string (possibly non-terminated string)
C:\Users\Cody\Desktop\OrbzGaming\SAMP\Server\gamemodes\grandlarc.pwn(86) : error 017: undefined symbol "ZPos"
C:\Users\Cody\Desktop\OrbzGaming\SAMP\Server\gamemodes\grandlarc.pwn(86) : error 029: invalid expression, assumed zero
C:\Users\Cody\Desktop\OrbzGaming\SAMP\Server\gamemodes\grandlarc.pwn(86) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


6 Errors.
Reply


Messages In This Thread
My Position Resets [Help!] - by xXRealLegitXx - 17.10.2012, 11:46
Re: My Position Resets [Help!] - by TzAkS. - 17.10.2012, 12:33
Re: My Position Resets [Help!] - by xXRealLegitXx - 17.10.2012, 19:36
Re: My Position Resets [Help!] - by caki - 17.10.2012, 20:05
Re: My Position Resets [Help!] - by xXRealLegitXx - 17.10.2012, 20:23
Re: My Position Resets [Help!] - by RedFusion - 17.10.2012, 20:28
Re: My Position Resets [Help!] - by xXRealLegitXx - 17.10.2012, 20:36
Re: My Position Resets [Help!] - by RedFusion - 17.10.2012, 20:40
Re: My Position Resets [Help!] - by xXRealLegitXx - 17.10.2012, 20:58
Re: My Position Resets [Help!] - by xXRealLegitXx - 17.10.2012, 21:02

Forum Jump:


Users browsing this thread: 3 Guest(s)