Hallo,
ich habe den Überblick irgendwie verloren ... ich wollte ein Filterscript in den Gamemode integrieren, was nicht immer einfach ist. xD
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new pname[MAX_PLAYERS],accFormat[128];
GetPlayerName(playerid,pname,sizeof pname);
format(accFormat,sizeof accFormat,"%s.log",pname);
if(response)
{
switch(dialogid) // dialogid auswählen
{
case DIALOG_LOGIN: // ID Login
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Bitte gib dein Passwort ein.","Verlassen","Abbrechen");
return SendClientMessage(playerid,0xFFFFFFFF,"Du hast kein Passwort eingegeben!");
}
if(strcmp(inputtext,dini_Get(accFormat,"Passwort")) == 0) // Passwort Direkt aus der Datei Laden
{
Player[playerid][adminlevel] = dini_Int(accFormat,"adminlevel");
Player[playerid][kills] = dini_Int(accFormat,"kills");
Player[playerid][deaths] = dini_Int(accFormat,"deaths");
Player[playerid][rank] = dini_Int(accFormat,"rank");
GivePlayerMoney(playerid,dini_Int(accFormat,"Geld"));
SetPlayerScore(playerid,dini_Int(accFormat,"kills"));
Player[playerid][onserver] = 1; // Player ist nun erfolgreich online
SendClientMessage(playerid,0xFFFFFFFF,"Successfully logged in!");
}
else
{
SendClientMessage(playerid, SKY, "BattleShip");
ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Enter your password and press ENTER.","Quit","Reset");
SendClientMessage(playerid,0xFFFFFFFF,"Wrong password!");
}
}
case DIALOG_REG: // ID Registrieren
{
if(!strlen(inputtext)) // Input-Feld darf nicht freigelassen werden
{
SendClientMessage(playerid, SKY, "BattleShip");
ShowPlayerDialog(playerid,DIALOG_REG,1,"Register","Enter a password and press ENTER.","Quit","Reset");
return SendClientMessage(playerid,0xFFFFFFFF,"The password is to short!");
}
dini_Create(accFormat);
dini_Set(accFormat,"Passwort",inputtext);
Player[playerid][onserver] = 1;
Player[playerid][rank] = 1;
SendClientMessage(playerid,0xFFFFFFFF,"Account registered! You are logged in!");
}
}
}
else
{
switch(dialogid)
{
case DIALOG_LOGIN:ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Enter your password and press ENTER.","Quit","Reset");
case DIALOG_REG:ShowPlayerDialog(playerid,DIALOG_REG,1,"Register","Enter a password and press ENTER.","Quit","Reset");
}
} //ShowPlayerDialog(playerid,DIALOG_SHOP,DIALOG_STYLE_LIST,"Shop","Cigar - 300$\nBeer - 450$\nDildo - 650$\nCheeseburger - 500$","Buy","Abbrechen");
switch(dialogid)
{
case DIALOG_SHOP: // ID Registrieren
{
if(listitem == 0) // Desert Eagle
{
if(price[listitem] >= GetPlayerMoney(playerid))return SendClientMessage(playerid,COLOR_RED,"Du hast nicht genug Geld!"); // Abfrage ob der Player Geld hat
GivePlayerWeapon(playerid,24,50);
GivePlayerMoney(playerid,-1000); //Zieht dem Player Geld ab
}
if(listitem == 1) // AK47
{
if(price[listitem] >= GetPlayerMoney(playerid))return SendClientMessage(playerid,COLOR_RED,"Du hast nicht genug Geld!");// Abfrage ob der Player Geld hat
GivePlayerWeapon(playerid,30,300);
GivePlayerMoney(playerid,-1500);//Zieht dem Player Geld ab
}
if(listitem == 2) //Messer
{
if(price[listitem] >= GetPlayerMoney(playerid))return SendClientMessage(playerid,COLOR_RED,"Du hast nicht genug Geld!");// Abfrage ob der Player Geld hat
GivePlayerWeapon(playerid,9,1);
GivePlayerMoney(playerid,-650);//Zieht dem Player Geld ab
}
if(listitem == 3)// MP5
{
if(price[listitem] >= GetPlayerMoney(playerid))return SendClientMessage(playerid,COLOR_RED,"Du hast nicht genug Geld!");// Abfrage ob der Player Geld hat
GivePlayerWeapon(playerid,29,200);// Gibt dem Player die Waffe
GivePlayerMoney(playerid,-1000);//Zieht dem Player Geld ab
}
}
switch(dialogid)
{
case DIALOG_REP: // ID Report
{
new string[256];
new idx;
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(inputtext);
while ((idx < length) && (inputtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = inputtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, GRAD2, "Error!");
return 1;
}
format(string, sizeof(string), "New Report! | %s [%s]", sendername, (result));
SendClientMessage(playerid, GRAD5, string);
format(string, sizeof(string), "[Report] %s [%s]", sendername, (result));
SendClientMessage(playerid, GRAD2, string);
ticketsys(string);
GameTextForPlayer(playerid, "Ticket saved",5000,3);
}
else
{
SendClientMessage(playerid, GRAD2, "Report Window closed.");
}
}
}
return 1;
}
Ich weiß nicht wie der Code richtig sein muss.
Ich bekomme 9 sinnlose Errors (OnPlayerRequestClass usw.).
Ich möchte keine Antworten hören wie "Klammerfehler". Ich finde ihn ja nicht, hab schon was ausprobiert. xD
//edit: Ich habe zuletzt den Dialog "DIALOG_REP" eingefügt!