Pomoc


Započeo Mikix, Mart 01, 2020, 15:26:22 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Problem(error/warning): Kako da napravim da posle registera odnosno kada ukuca koji oce pasword da mu bude da mu posle toga izbaci
da izabere pol,kada sam ja namjestio izbaci da izbabere pol ali nakon toga ne pita za sifru vec pise ono dole spawn
Dio skripte: Ako bude bilo potrebno poslacu....
Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log): //
Slika/video ingame problema(obavezno ako je ingame problem)
Ako neko zna neka pomogne... :-X :-X :-X

Ocigledno nisi definisao sta da se desi kada odabere pol. Stavi da mu otvori dialog za password ako vec tako zelis..

Evo kako sam napravio ovo gdje sad da stavim da posle kad upise lozinku da mu izadje za pol
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;
}

i EVO ONPLAYERDIALOG
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"Great! Your Y_INI system works perfectly. Relog to save your stats!","Ok","");
            }
        }

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

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_WriteInt(File,"Pol",0);
                INI_Close(File);

                ShowPlayerDialog(playerid, DIALOG_POL, DIALOG_STYLE_MSGBOX, "Registracija", "Odaberi pol", "Musko", "Zensko");
            }
        }


Takodje, definises DIALOG_POL isto kao sto si DIALOG_REGISTER i DIALOG_LOGIN, zatim u cuvanju igraca dodajes pPol, nakon toga mozes da radis sta ti je volja sa tim, da li ces mu setati skin na osnovu toga, na tebi je..
Evo ti i za DIALOG_POL kako bi otprilike izgledalo
case DIALOG_POL:
        {
            if(!response)
            {
                PlayerInfo[playerid][pPol] = 2; //Zensko
                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
                return 1;
            }
            if(response)
            {
                PlayerInfo[playerid][pPol] = 1; //Musko
                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
                return 1;
            }
        }


Nadam se da sam pomogao, nauci prvo osnove :/

E hvala ti mozes mi sada reci u texdrawu za stats kako da stavim ako je pPol= 1 Da mu stavi da je musko a kako ako je pPol=2 stavi zensko
Textdraw10 = CreatePlayerTextDraw(playerid,577.500000, 266.933288, "Pol");
	PlayerTextDrawLetterSize(playerid,Textdraw10, 0.413500, 1.201777);
	PlayerTextDrawAlignment(playerid,Textdraw10, 1);
	PlayerTextDrawColor(playerid,Textdraw10, -1);
	PlayerTextDrawSetShadow(playerid,Textdraw10, 0);
	PlayerTextDrawSetOutline(playerid,Textdraw10, 1);
	PlayerTextDrawBackgroundColor(playerid,Textdraw10, 51);
	PlayerTextDrawFont(playerid,Textdraw10, 1);
	PlayerTextDrawSetProportional(playerid,Textdraw10, 1);

Hmmm, putem PlayerTextDrawSetString??

Kada kuca /stats, prikaze textdraw, uradis ovako nesto:

new poligraca[10];
if(PlayerInfo[playerid][pPol] = 1) { poligraca = "Musko"; }
if(PlayerInfo[playerid][pPol] = 2) { poligraca = "Zensko"; }
new string[20];
format(string, 20, "Pol:%s", poligraca);
PlayerTextDrawSetString(playerid, Textdraw10, string);


Naravno, ovo ti je primer jedan, ti prilagodi kako ti odgovara..

SyS

*

Citat: V01D poslato Mart 02, 2020, 22:03:25 POSLE PODNE
Hmmm, putem PlayerTextDrawSetString??

Kada kuca /stats, prikaze textdraw, uradis ovako nesto:

new poligraca[10];
if(PlayerInfo[playerid][pPol] = 1) { poligraca = "Musko"; }
if(PlayerInfo[playerid][pPol] = 2) { poligraca = "Zensko"; }
new string[20];
format(string, 20, "Pol:%s", poligraca);
PlayerTextDrawSetString(playerid, Textdraw10, string);


Naravno, ovo ti je primer jedan, ti prilagodi kako ti odgovara..

PlayerTextDrawSetString(playerid, Textdraw10, (PlayerInfo[playerid][pPol] == 1) ? ("Musko") : ("Zensko")); :D

Citat: SyS poslato Mart 02, 2020, 22:04:58 POSLE PODNE
PlayerTextDrawSetString(playerid, Textdraw10, (PlayerInfo[playerid][pPol] == 1) ? ("Musko") : ("Zensko")); :D

Ja sam jako kompleksan momak xDD :D

Imam ova dva error
1229) : warning 211: possibly unintended assignment
(1230) : warning 211: possibly unintended assignment


Kod ovoga
if(PlayerInfo[playerid][pPol] = 1) { poligraca = "Musko"; }
	if(PlayerInfo[playerid][pPol] = 2) { poligraca = "Zensko"; }
Poslednja Izmena: Mart 02, 2020, 22:28:46 POSLE PODNE od Mikix

if(PlayerInfo[playerid][pPol] == 1) { poligraca = "Musko"; }
if(PlayerInfo[playerid][pPol] == 2) { poligraca = "Zensko"; }


Moja greska :/

SyS

*

Citat: Mikix poslato Mart 02, 2020, 22:27:35 POSLE PODNE
Imam ova dva error
1229) : warning 211: possibly unintended assignment
(1230) : warning 211: possibly unintended assignment


Kod ovoga
if(PlayerInfo[playerid][pPol] = 1) { poligraca = "Musko"; }
	if(PlayerInfo[playerid][pPol] = 2) { poligraca = "Zensko"; }


Zasto prosto ne prekoprias ono sto sam ja poslao?
Aj sto je urednije nego sto je i brze i ne kreiras string niti ista :)

Ne izbacije mi ni da je musko ni da je zesnko mozes mi u fulu napravit citav kod
Textdraw10 = CreatePlayerTextDraw(playerid,577.500000, 266.933288, "Pol");
	PlayerTextDrawLetterSize(playerid,Textdraw10, 0.413500, 1.201777);
	PlayerTextDrawAlignment(playerid,Textdraw10, 1);
	PlayerTextDrawColor(playerid,Textdraw10, -1);
	PlayerTextDrawSetShadow(playerid,Textdraw10, 0);
	PlayerTextDrawSetOutline(playerid,Textdraw10, 1);
	PlayerTextDrawBackgroundColor(playerid,Textdraw10, 51);
	PlayerTextDrawFont(playerid,Textdraw10, 1);
	PlayerTextDrawSetProportional(playerid,Textdraw10, 1);

pa dodaj gdje treba to

Citat: SyS poslato Mart 02, 2020, 22:40:30 POSLE PODNE
Zasto prosto ne prekoprias ono sto sam ja poslao?
Aj sto je urednije nego sto je i brze i ne kreiras string niti ista :)

Zasto? Teze mu je da skapira. 90% ljudi ovde ne zna sta tvoja linija znaci, znas zasto? Zato sto to niko nije ucio, Balkanci to ne primenjuju.. A ovi danas nece da uce od 0, vec hoce odmah da edituju i tako da "uce"..

Citat: Mikix poslato Mart 02, 2020, 22:45:14 POSLE PODNE
Ne izbacije mi ni da je musko ni da je zesnko mozes mi u fulu napravit citav kod
Textdraw10 = CreatePlayerTextDraw(playerid,577.500000, 266.933288, "Pol");
	PlayerTextDrawLetterSize(playerid,Textdraw10, 0.413500, 1.201777);
	PlayerTextDrawAlignment(playerid,Textdraw10, 1);
	PlayerTextDrawColor(playerid,Textdraw10, -1);
	PlayerTextDrawSetShadow(playerid,Textdraw10, 0);
	PlayerTextDrawSetOutline(playerid,Textdraw10, 1);
	PlayerTextDrawBackgroundColor(playerid,Textdraw10, 51);
	PlayerTextDrawFont(playerid,Textdraw10, 1);
	PlayerTextDrawSetProportional(playerid,Textdraw10, 1);

pa dodaj gdje treba to

Posalji celu komandu gde prikazujes tdove

public OnPlayerConnect( playerid )
{
	new tdstring[128];
	format(tdstring, sizeof(tdstring), "Ime i Prezime:~n~ ~y~ ~h~%s",PlayerName(playerid));
	Textdraw6 = CreatePlayerTextDraw(playerid,497.000000, 266.311096,tdstring);
	PlayerTextDrawLetterSize(playerid,Textdraw6, 0.245000, 1.257777);
	PlayerTextDrawAlignment(playerid,Textdraw6, 1);
	PlayerTextDrawColor(playerid,Textdraw6, -1);
	PlayerTextDrawSetShadow(playerid,Textdraw6, 0);
	PlayerTextDrawSetOutline(playerid,Textdraw6, 1);
	PlayerTextDrawBackgroundColor(playerid,Textdraw6, 51);
	PlayerTextDrawFont(playerid,Textdraw6, 1);
	PlayerTextDrawSetProportional(playerid,Textdraw6, 1);
	
	PlayerTextDrawSetString(playerid, Textdraw10, (PlayerInfo[playerid][pPol] == 1) ? ("~n~ ~w~Musko") : ("~n~ ~w~Zensko"));//OVO SAM SAD DODAO KAKO JE OVAJ GORE NAPISAO
	Textdraw10 = CreatePlayerTextDraw(playerid,577.500000, 266.933288,"Pol");
	PlayerTextDrawLetterSize(playerid,Textdraw10, 0.413500, 1.201777);
	PlayerTextDrawAlignment(playerid,Textdraw10, 1);
	PlayerTextDrawColor(playerid,Textdraw10, -1);
	PlayerTextDrawSetShadow(playerid,Textdraw10, 0);
	PlayerTextDrawSetOutline(playerid,Textdraw10, 1);
	PlayerTextDrawBackgroundColor(playerid,Textdraw10, 51);
	PlayerTextDrawFont(playerid,Textdraw10, 1);
	PlayerTextDrawSetProportional(playerid,Textdraw10, 1);
	return 1;
}
CMD:stats(playerid, params[], help)
{
		    PlayerTextDrawShow(playerid, Textdraw0);
		    PlayerTextDrawShow(playerid, Textdraw1);
		    PlayerTextDrawShow(playerid, Textdraw2);
		    PlayerTextDrawShow(playerid, Textdraw3);
		    PlayerTextDrawShow(playerid, Textdraw4);
		    PlayerTextDrawShow(playerid, Textdraw5);
		    PlayerTextDrawShow(playerid, Textdraw6);
		    PlayerTextDrawShow(playerid, Textdraw7);
		    PlayerTextDrawShow(playerid, Textdraw8);
		    PlayerTextDrawShow(playerid, Textdraw9);
		    PlayerTextDrawShow(playerid, Textdraw10);
		    PlayerTextDrawShow(playerid, Textdraw11);
		    PlayerTextDrawShow(playerid, Textdraw12);
		    PlayerTextDrawShow(playerid, Textdraw13);
		    PlayerTextDrawShow(playerid, Textdraw14);
		    PlayerTextDrawShow(playerid, Textdraw15);
		    PlayerTextDrawShow(playerid, Textdraw16);
		    PlayerTextDrawShow(playerid, Textdraw17);
		    PlayerTextDrawShow(playerid, Textdraw18);
		    PlayerTextDrawShow(playerid, Textdraw19);
		    PlayerTextDrawShow(playerid, Textdraw20);
                    //ovdej ima vise texdrawova al nisam stavljao gore sve da bez veze punim mjesta,...
		    return 1;
}

Citat: Mikix poslato Mart 02, 2020, 23:04:35 POSLE PODNE
public OnPlayerConnect( playerid )
{
	new tdstring[128];
	format(tdstring, sizeof(tdstring), "Ime i Prezime:~n~ ~y~ ~h~%s",PlayerName(playerid));
	Textdraw6 = CreatePlayerTextDraw(playerid,497.000000, 266.311096,tdstring);
	PlayerTextDrawLetterSize(playerid,Textdraw6, 0.245000, 1.257777);
	PlayerTextDrawAlignment(playerid,Textdraw6, 1);
	PlayerTextDrawColor(playerid,Textdraw6, -1);
	PlayerTextDrawSetShadow(playerid,Textdraw6, 0);
	PlayerTextDrawSetOutline(playerid,Textdraw6, 1);
	PlayerTextDrawBackgroundColor(playerid,Textdraw6, 51);
	PlayerTextDrawFont(playerid,Textdraw6, 1);
	PlayerTextDrawSetProportional(playerid,Textdraw6, 1);
	
	PlayerTextDrawSetString(playerid, Textdraw10, (PlayerInfo[playerid][pPol] == 1) ? ("~n~ ~w~Musko") : ("~n~ ~w~Zensko"));//OVO SAM SAD DODAO KAKO JE OVAJ GORE NAPISAO
	Textdraw10 = CreatePlayerTextDraw(playerid,577.500000, 266.933288,"Pol");
	PlayerTextDrawLetterSize(playerid,Textdraw10, 0.413500, 1.201777);
	PlayerTextDrawAlignment(playerid,Textdraw10, 1);
	PlayerTextDrawColor(playerid,Textdraw10, -1);
	PlayerTextDrawSetShadow(playerid,Textdraw10, 0);
	PlayerTextDrawSetOutline(playerid,Textdraw10, 1);
	PlayerTextDrawBackgroundColor(playerid,Textdraw10, 51);
	PlayerTextDrawFont(playerid,Textdraw10, 1);
	PlayerTextDrawSetProportional(playerid,Textdraw10, 1);
	return 1;
}
CMD:stats(playerid, params[], help)
{
		    PlayerTextDrawShow(playerid, Textdraw0);
		    PlayerTextDrawShow(playerid, Textdraw1);
		    PlayerTextDrawShow(playerid, Textdraw2);
		    PlayerTextDrawShow(playerid, Textdraw3);
		    PlayerTextDrawShow(playerid, Textdraw4);
		    PlayerTextDrawShow(playerid, Textdraw5);
		    PlayerTextDrawShow(playerid, Textdraw6);
		    PlayerTextDrawShow(playerid, Textdraw7);
		    PlayerTextDrawShow(playerid, Textdraw8);
		    PlayerTextDrawShow(playerid, Textdraw9);
		    PlayerTextDrawShow(playerid, Textdraw10);
		    PlayerTextDrawShow(playerid, Textdraw11);
		    PlayerTextDrawShow(playerid, Textdraw12);
		    PlayerTextDrawShow(playerid, Textdraw13);
		    PlayerTextDrawShow(playerid, Textdraw14);
		    PlayerTextDrawShow(playerid, Textdraw15);
		    PlayerTextDrawShow(playerid, Textdraw16);
		    PlayerTextDrawShow(playerid, Textdraw17);
		    PlayerTextDrawShow(playerid, Textdraw18);
		    PlayerTextDrawShow(playerid, Textdraw19);
		    PlayerTextDrawShow(playerid, Textdraw20);
                    //ovdej ima vise texdrawova al nisam stavljao gore sve da bez veze punim mjesta,...
		    return 1;
}

Textdraw10 = CreatePlayerTextDraw(playerid,577.500000, 266.933288,(PlayerInfo[playerid][pPol] == 1) ? ("~n~ ~w~Musko") : ("~n~ ~w~Zensko"));