Spawn onder Blueberry..
#1

HoiHoi,

Zodra ik een account wil aanmaken op m'n server dan spawn ik onder Blueberry.
Als ik geen wachtwoord in vul (en dus door ga naar het 2e registratie dialoog) dan spawn ik wel waar ik moet spawnen.
Hij geeft ook altijd "Request: 2" aan dus zou hij normaal goed moeten spawnen..
Ik heb al van alles doorzocht en geprobeerd maar niks heeft echt wat geholpen..

Dit is m'n eerste gamemode (is een training gamemode).

Code:
Code:
//Credits to Y_Less, Dracoblue and Kush.

#include <a_samp>
#include <YSI\y_ini>
#include <zcmd>
#include <sscanf2>
#include <foreach>

// ------ Dialogs ----- //

#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3
#define DIALOG_SUCCESS_2 4
#define DIALOG_LOCATION 5
#define DIALOG_HELP 6
#define DIALOG_HELP_ADMIN 7
#define DIALOG_TELES 8
#define DIALOG_SOLDIERDUTY 9
#define DIALOG_CREDITS 10
#define DIALOG_INFORMATION 11
#define DIALOG_DUTIES 12

// ------- Accounts ------//

#define PATH "/Users/%s.ini"

// ------- Colors ------ //

#define COL_WHITE "{FFFFFF}"
#define COL_RED "{FF0000FF}"
#define COL_GREEN "{00FF22}"
#define COL_LIGHTBLUE "{00CED1}"
#define COLOR_GREY 0xADADADFF
#define COLOR_RED 0xFF3D3DFF
#define COLOR_LIGHTRED 0xFF6347FF
#define COLOR_PURPLE 0xFF2E6DFF

#define COLOR_ADMINRED 0xFF0000FF
#define COLOR_DUTYPOINTS 0xFFFFFFFF
#define COLOR_INFOPOINTS 0xFFFFFFFF
#define COLOR_INFO 0x00FF00FF
#define COLOR_SOLDIERDUTY 0x008000FF
#define COLOR_CONNECTIONS 0xC4C4C4FF


enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pAdminDuty,
    pSkin,
    pSoldierLevel,
    pSoldierDuty,
    pCriminalDuty
}

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("AdminDuty",PlayerInfo[playerid][pAdminDuty]);
    INI_Int("Skin",PlayerInfo[playerid][pSkin]);
    INI_Int("SoldierLevel",PlayerInfo[playerid][pSoldierLevel]);
    INI_Int("SoldierDuty",PlayerInfo[playerid][pSoldierDuty]);
    INI_Int("CriminalDuty",PlayerInfo[playerid][pCriminalDuty]);
    return 1;
}

stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}

/*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;
}

main()
{
	print("\n--------------------------------------------------");
	print("Training Server");
	print("--------------------------------------------------\n");
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerCameraPos(playerid, 1061.1375, -1348.5317, 72.5953);
    SetPlayerCameraLookAt(playerid, 1062.0928, -1348.8217, 72.5754);
    TogglePlayerSpectating(playerid, true);
    return 1;
}

public OnPlayerConnect(playerid)
{
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
        SetPlayerCameraPos(playerid, 1061.1375, -1348.5317, 72.5953);
        SetPlayerCameraLookAt(playerid, 1062.0928, -1348.8217, 72.5754);

	}
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,""COL_WHITE"Create an account",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
        SendClientMessage(playerid,COLOR_INFO,"Request: 0");
	}
    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_PASSWORD, ""COL_WHITE"Create an account","{FF0000}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",5000);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"AdminDuty",0);
                INI_WriteInt(File,"Skin",26);
                INI_WriteInt(File,"SoldierLevel",0);
                INI_WriteInt(File,"SoldierDuty",0);
                INI_WriteInt(File,"CriminalDuty",0);
                INI_Close(File);

                new string[128];
                format(string,sizeof(string),"Welcome to the training server.", GetName(playerid));
                SendClientMessage(playerid, COLOR_INFO, string);
                SetPlayerSkin(playerid, 26);
                PlayerInfo[playerid][pSkin] = 26;
                /* Connection messages */
                new szString[64];
                new name[MAX_PLAYER_NAME+1];
                GetPlayerName(playerid, name, sizeof(name));
                format(szString, sizeof szString, "%s has joined the server.", name);
                SendClientMessageToAll(COLOR_CONNECTIONS, szString);
                SendClientMessage(playerid,COLOR_INFO,"Request: 2");
                SetSpawnInfo(playerid, 0, 26, 1755.8621, -1893.4226, 13.5566, 272.8052, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
            }
        }
    }
    return 1;
}
Oplossing:
Quote:
Originally Posted by mamorunl
View Post
AddPlayerClass
Alvast bedankt.
Reply
#2

Heb je wel goeie coordinaten bij setspawninfo?
Reply
#3

Ja, Want als ik de 2e registratie dialoog krijg (waarin staat dat je een "verboden" wachtwoord hebt ingetypt) dan lukt het wel. :P
Reply
#4

Heb je niet altijd nog sowieso een AddPlayerClass nodig?
Reply
#5

Quote:
Originally Posted by mamorunl
View Post
Heb je niet altijd nog sowieso een AddPlayerClass nodig?
Dit ^
Reply
#6

Bedankt.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)