Gamemode with 2 Languages Help!
#1

Hello all,
i want to make my server with 2 languages
i founded a script from samp forums.
I created them 2 languages and i give you the script.
Here its it:
1. 2 Languages as info:
Код:
enum pInfo
{
    pLang1,
    pLang2,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
2.A connect Dialog:
Код:
ShowPlayerDialog(playerid,69,DIALOG_STYLE_LIST,"Select your language","Language1\nLanguage2","Select","Cancel");
3.Languages Dialog Response:
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid==69)
    {
        case 1:
        {
            if(!response)
            {
                SendClientMessage(playerid,0xFF0000FF,"You didn't choose language!");
                SendClientMessage(playerid,0xFF0000FF,"So now you will be kick. | Reason: Didn't choose laguage.");
                Kick(playerid);
                return 1;
            }
            switch(listitem)
            {
                case 0:
                {
                    SendClientMessage(playerid,0xFF0000FF,"You selected language 1");
                    PlayerInfo[playerid][pLang1] =1;
                }
                case 1:
                {
                	SendClientMessage(playerid,0xFF0000FF,"You selected language 2");
                    PlayerInfo[playerid][pLang2] =1;
                }
            }
            return 1;
        }
   }
   return 1;
4. And here its 1 of my commands with these 2 languages :
Код:
	if(strcmp(cmd, "/minigames", true) == 0)
	{
		if(PlayerInfo[playerid][pLang1] == 1)
		{
		    ShowPlayerDialog(playerid, 656454, DIALOG_STYLE_MSGBOX, "Here is the text with language 1", "Ok", "" );
		}
		else if(PlayerInfo[playerid][pLang2] == 1)
		{
		    ShowPlayerDialog(playerid, 656454, DIALOG_STYLE_MSGBOX, "Here is the text with language 2", "Ok", "" );
		}
	}
All of my comands have this type [Example 4]!
So i have tried more than 4 methods to fix it and if i join in my server, no one of commands its work.
Why?
Reply
#2

When you compile script do you see any warning?
Reply
#3

have you put
pawn Код:
return 0;
in OnPlayerCommandText callbacks on your script?
and put
pawn Код:
return 1;
after commands? example:
Quote:
Originally Posted by HotPlayer
Посмотреть сообщение
Hello all,
4. And here its 1 of my commands with these 2 languages :
pawn Код:
if(strcmp(cmd, "/minigames", true) == 0)
{
    if(PlayerInfo[playerid][pLang1] == 1)
    {
        ShowPlayerDialog(playerid, 656454, DIALOG_STYLE_MSGBOX, "Here is the text with language 1", "Ok", "" );
    }
    else if(PlayerInfo[playerid][pLang2] == 1)
    {
        ShowPlayerDialog(playerid, 656454, DIALOG_STYLE_MSGBOX, "Here is the text with language 2", "Ok", "" );
    }
    return 1;
}
Reply
#4

if i use:
return 1;
i have again crash
Example if i use return 1; in all commands with 2 languages,
and after this i join in my server and i type: /minigames this will be crash and its show me diffrent thing!

And i compile it and i dont have any warning or error!
Quote:

When you compile script do you see any warning?

Anyone to help?
Reply
#5

Quote:

enum pInfo
{
pLang1,
pLang2,
}
new PlayerInfo[MAX_PLAYERS][pInfo];

You can use single variable for it ?
pawn Код:
new Language[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
   Language[playerid] = 1// set a default language
   return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid==69)
    {
        case 1:
        {
            if(!response)
            {
                SendClientMessage(playerid,0xFF0000FF,"You didn't choose language!");
                SendClientMessage(playerid,0xFF0000FF,"So now you will be kick. | Reason: Didn't choose laguage.");
                Kick(playerid);
                return 1;
            }
            switch(listitem)
            {
                case 0:
                {
                    SendClientMessage(playerid,0xFF0000FF,"You selected language 1");
                    Language[playerid] = 1;
                }
                case 1:
                {
                    SendClientMessage(playerid,0xFF0000FF,"You selected language 2");
                    Language[playerid] = 2;
                }
            }
            return 1;
        }
   }
   return 1;

if(strcmp(cmd, "/minigames", true) == 0)
{
        if(Language[playerid] == 1)
        {
            ShowPlayerDialog(playerid, 656454, DIALOG_STYLE_MSGBOX, "Here is the text with language 1", "Ok", "" );
        }
        else if(Langauge[playerid] == 2)
        {
            ShowPlayerDialog(playerid, 656454, DIALOG_STYLE_MSGBOX, "Here is the text with language 2", "Ok", "" );
        }
}
Reply
#6

pawn Код:
if(strcmp(cmd, "/minigames", true) == 0)
    {
        if(PlayerInfo[playerid][pLang1] == 1)
        {
            ShowPlayerDialog(playerid, 656454, DIALOG_STYLE_MSGBOX, "Language 1","Here is the text with language 1", #Ok, #);
            return 1;
        }
        else if(PlayerInfo[playerid][pLang2] == 1)
        {
            ShowPlayerDialog(playerid, 656454, DIALOG_STYLE_MSGBOX, "Language 2", "Here is the text with language 2", #Ok, #);
            return 1;
        }
    }
Reply
#7

I have an big dialog and it is crash all of them!
but why i am do it right
Hey i want to say i have seen the try of this post: https://sampforum.blast.hk/showthread.php?tid=236758
Please help me
i use this method:
Код:
enum pInfo
{
    pEnglish,
    pSerbian,
}
new PlayerInfo[MAX_PLAYERS][pInfo];


In your language dialog make that if player chooses English then = 1 and Serbian = 0 if Serbian then = 1 and English = 0.

Now make command like that
pawn Code:

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/kill", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid,0);
        if(PlayerInfo[playerid][pEnglish] == 1)
        {
            SendClientMessage(playerid,0xFF0000FF,"You suck");
        }
        if(PlayerInfo[playerid][pSerbian] == 1)
        {
            SendClientMessage(playerid,0xFF0000FF,"You suck in serbian");
        }
    }
    return 0;
}
is in page number 2!
Please help!
i have make it like this:
Код:
if (strcmp("/kill", cmdtext, true, 10) == 0)
    {
        if(PlayerInfo[playerid][pEnglish] == 1)
        {
            SetPlayerHealth(playerid,0);
            SendClientMessage(playerid,0xFF0000FF,"You suck");
        }
        if(PlayerInfo[playerid][pSerbian] == 1)
        {
             SetPlayerHealth(playerid,0);
            SendClientMessage(playerid,0xFF0000FF,"You suck in serbian");
        }
    } // i do not see return here why?
Help me i need this solution!
Reply
#8

can anyone help in this script
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)