30.11.2009, 18:56
I'm still going to make version 2, but the question is when
Originally Posted by Toney
Och thanks.. i really needed it .
|
Originally Posted by _Gangster_
nice !!
good job. |
Originally Posted by MaVe - leeturl.de
I personally don't like it very much, it's neither very comfortable nor very efficient, sorry.
|
Originally Posted by Don Correlli
This is really not efficient, try to code more efficiently.
|
Originally Posted by MaVe - leeturl.de
I personally don't like it very much, it's neither very comfortable nor very efficient, sorry.
|
#define TXT_WELCOME_EN "Welcome to my server" #define TXT_WELCOME_DE "Willkommen auf meinem Server"
SendLanguageMessage(playerid, COLOR_GREEN, TXT_WELCOME); // without _DE, append that with a macro?
Originally Posted by MaVe - leeturl.de
I think most people don't want to change the function parameters if they have like 1 more language to add, it's also not very comfortable to have 2 or even more strings all the time.
I suggest using something like a "text library part" in your gamemode with defines for all texts like Код:
#define TXT_WELCOME_EN "Welcome to my server" #define TXT_WELCOME_DE "Willkommen auf meinem Server" pawn Код:
|
Originally Posted by sstk (Шустрик)
Nice, useful script
|
#define LANG_DE 1
#define LANG_EN 2
#define WELCOME_DE "Willkommen"
#define WELCOME_EN "Welcome"
#define SetLanguage(%1) \
language = %1
#define GetLanguage() \
language
#define PrintInLanguage(%1) \
if (language == LANG_DE) \
print(%1_DE); \
else if (language == LANG_EN) \
print(%1_EN)
new language = 0;
public OnFilterScriptInit()
{
SetLanguage(LANG_DE);
PrintInLanguage(WELCOME);
SetLanguage(LANG_EN);
PrintInLanguage(WELCOME);
return 1;
}
dcmd_racetrack(playerid, params[]) { #pragma unused params if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { SetVehicleVirtualWorld(playerid, 0); SetVehiclePos(GetPlayerVehicleID(playerid), 554.0462,-2840.1121,7.4550+5); } else { new pname[MAX_PLAYER_NAME], string1[256], string2[256]; GetPlayerName(playerid, pname, sizeof(pname)); format(string1, sizeof(string1), "%s has Teleported to /racetrack.", pname); GetPlayerName(playerid, pname, sizeof(pname)); format(string2, sizeof(string2), "%s Is naar /racetrack geteleporteert", pname); SendLanguageMessageToAll(COLOR_DARKGREEN,string1,string2); } return 1; }
#define Englisch 0 #define Dutch 1
Originally Posted by shotyoudie
How do i make a command now ??
i tryed this: Код:
dcmd_racetrack(playerid, params[]) { #pragma unused params if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { SetVehicleVirtualWorld(playerid, 0); SetVehiclePos(GetPlayerVehicleID(playerid), 554.0462,-2840.1121,7.4550+5); } else { new pname[MAX_PLAYER_NAME], string1[256], string2[256]; GetPlayerName(playerid, pname, sizeof(pname)); format(string1, sizeof(string1), "%s has Teleported to /racetrack.", pname); GetPlayerName(playerid, pname, sizeof(pname)); format(string2, sizeof(string2), "%s Is naar /racetrack geteleporteert", pname); SendLanguageMessageToAll(COLOR_DARKGREEN,string1,string2); } return 1; } Код:
#define Englisch 0 #define Dutch 1 |
public OnPlayerConnect(playerid)
{
SetPlayerLanguage(playerid, Dutch);
return 1;
}
dcmd_racetrack(playerid, params[])
{
#pragma unused params
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
SetVehicleVirtualWorld(playerid, 0);
SetVehiclePos(GetPlayerVehicleID(playerid), 554.0462,-2840.1121,7.4550+5);
}
else
{
new pname[MAX_PLAYER_NAME], string1[256], string2[256];
GetPlayerName(playerid, pname, sizeof(pname));
format(string1, sizeof(string1), "%s has teleported to /racketrack.", pname);
format(string2, sizeof(string2), "%s Is naar /racketrack geteleporteert", pname),
SendLanguageMessageToAll(COLOR_DARKGREEN,string1,string2);
}
return 1;
}
OnPlayerConnect: ShowPlayerDialog(playerid,212, DIALOG_STYLE_LIST,"Select your language:","1\tEnglisch\n2\tDutch","Select","Cancel"); OnDialogResponse: } if(dialogid == 212 && response == 1) { if(listitem == 0) { SetPlayerLanguage(playerid, Englisch); SendClientMessage(playerid, COLOR_YELLOW, "Your language is set to Englisch"); } if(listitem == 1) { SetPlayerLanguage(playerid, Dutch); SendClientMessage(playerid, COLOR_YELLOW, "Je taal is gezet op Nederlands"); } return 1; } return 0; }
dcmd_racetrack(playerid, params[])
{
#pragma unused params
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
SetVehicleVirtualWorld(playerid, 0);
SetVehiclePos(GetPlayerVehicleID(playerid), 554.0462,-2840.1121,7.4550+5);
}
else
{
new pname[MAX_PLAYER_NAME], string1[256], string2[256];
GetPlayerName(playerid, pname, sizeof(pname));
format(string1, sizeof(string1), "%s has Teleported to /racetrack.", pname);
format(string2, sizeof(string2), "%s Is naar /racetrack geteleporteert", pname);
for(new i; i < MAX_PLAYERS < i++;) SendLanguageMessage(i, COLOR_DARKGREEN, string1, string2);
}
return 1;
}