18.12.2011, 06:02
That's because those variables are already defined, also, put return 1; after login so it would look like this..
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == register)
{
GetPlayerName(playerid, Name, sizeof(Name));
format(file, sizeof(file), SERVER_USER_FILE, Name);
if(!response) return Kick(playerid);
if (!strlen(inputtext)) return
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Register", "Welcome, your not registered, please fill in a password", "Register", "Leave");
dini_Create(file);
dini_IntSet(file, "Password", udb_hash(inputtext));
dini_IntSet(file, "AdminLevel",0);
dini_IntSet(file, "Money",0);
dini_IntSet(file, "Score",0);
dini_IntSet(file, "Warns",0);
format(String, 128, "[SYSTEM]: You succesfully registered the nickname %s with password %s, you have been auto logged in.", Name, inputtext);
SendClientMessage(playerid, COLOR_YELLOW, String);
gPlayerLogged[playerid] = 1;
return l;
}
if (dialogid == login)
{
GetPlayerName(playerid, Name, sizeof(Name));
format(file, sizeof(file), SERVER_USER_FILE, Name);
if(!response) return Kick(playerid);
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Login", "You're already registered, please login.", "Login", "Leave");
new tmp;
tmp = dini_Int(file, "Password");
if(udb_hash(inputtext) != tmp)
{
SendClientMessage(playerid, COLOR_RED, "Wrong password");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Login", "You're already registered, please login.", "Login", "Leave");
}
else
{
gPlayerLogged[playerid] = 1;
PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
PlayerInfo[playerid][pScore] = dini_Int(file, "Score");
PlayerInfo[playerid][pWarns] = dini_Int(file, "Warns");
PlayerInfo[playerid][pCash] = dini_Int(file, "Money");
Save[playerid] = SetTimerEx("SaveStats",1000,true,"i",playerid);
SendClientMessage(playerid,COLOR_RED, "[SYSTEM]: Successfully logged in!");
GivePlayerMoney(playerid,PlayerInfo[playerid][pCash]);
SetPlayerScore(playerid,PlayerInfo[playerid][pScore]);
if(PlayerInfo[playerid][pAdminLevel] >0)
{
format(String,sizeof(String),"Admin %s has logged in",Name[playerid]);
SendClientMessageToAll(COLOR_ORANGE,String);
}
}
return 1;
}
if(dialogid == teleports && response) // If you edit something in the actual dialog commands, edit this too. Be sure to make case numbers line up, too.
{
switch(listitem)
{
case 0: dcmd_stuntzones(playerid, "");
case 1: dcmd_dmzones(playerid, "");
case 2: dcmd_parkourzones(playerid, "");
case 3: dcmd_otherzones(playerid, "");
}
return 1;
}
if(dialogid == stunting && response)
{
switch(listitem)
{
case 0: dcmd_bigjump(playerid, "");
case 1: dcmd_bigjump2(playerid, "");
case 2: dcmd_lstower(playerid, "");
case 3: dcmd_buildingjump(playerid, "");
case 4: dcmd_chilliad(playerid, "");
case 5: dcmd_skatepark(playerid, "");
case 6: dcmd_lvairport(playerid, "");
case 7: dcmd_aquapark(playerid, "");
case 8: dcmd_freeway(playerid, "");
case 9: dcmd_deadjump(playerid, "");
case 10: dcmd_wallride(playerid, "");
case 11: dcmd_waytodeath(playerid, "");
case 12: dcmd_stadium(playerid, "");
case 13: dcmd_monstercrash(playerid, "");
case 14: dcmd_drift(playerid, "");
}
return 1;
}
if(dialogid == deathmatchs && response)
{
switch(listitem)
{
case 0: dcmd_bloodringarena(playerid, "");
case 1: dcmd_airbattle(playerid, "");
case 2: dcmd_derby(playerid, "");
case 3: dcmd_mgm(playerid, "");
case 4: dcmd_gm(playerid, "");
case 5: dcmd_sm(playerid, "");
case 6: dcmd_rcwar(playerid, "");
}
return 1;
}
if(dialogid == others && response)
{
switch(listitem)
{
case 0: dcmd_home(playerid, "");
case 1: dcmd_tune1(playerid, "");
case 2: dcmd_tune2(playerid, "");
case 3: dcmd_tune3(playerid, "");
case 4: dcmd_tune4(playerid, "");
case 5: dcmd_AA(playerid, "");
case 6: dcmd_dragrace(playerid, "");
case 7: dcmd_karting(playerid, "");
case 8: dcmd_ctruckstop(playerid, "");
case 9: dcmd_lsstation(playerid, "");
case 10: dcmd_sfstation(playerid, "");
case 11: dcmd_lvstation1(playerid, "");
case 12: dcmd_lvstation2(playerid, "");
case 13: dcmd_dtruckstop(playerid, "");
}
return 1;
}
return 1;
}