13.07.2010, 04:07
err.. im trying to make a dialog for onplayerrequestclass D:
ingore the warnings lol
thats the line<.<
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)
{
if(dialogid == 1 || dialogid == 12347)
{
if(strlen(inputtext))
{
new ppw[20], str[128];
format(pfile, sizeof(pfile), pfile_path, Playername(playerid));
if(sscanf(params, "s", ppw)) return SendMsg(playerid, RED, "*USAGE: /login [password]");
else if(strlen(ppw) < 3) return SendMsg(playerid, RED, "*Error: Password is too short to be correct");
else if(strlen(ppw) > 20) return SendMsg(playerid, RED, "*Error: Password is too long to be correct");
else if(IsLogged[playerid] == 1) return SendMsg(playerid, RED, "*Error: You are already logged in");
else if(!dini_Exists(pfile)) return SendMsg(playerid, RED, "*Error: No account with that username is registered, please register");
else
{
format(pfile, sizeof(pfile), pfile_path, Playername(playerid));
new playerpw[256];
playerpw = dini_Get(pfile, "Password");
if(strcmp(playerpw, ppw, true) == 0)
{
format(str, sizeof(str), "*Success: You have Successfully Logged In %s", Playername(playerid), dini_Int(pfile, "AdminLevel"));
SendMsg(playerid, LIME, str);
LoadPlayer(playerid);
IsLogged[playerid] = 1;
SetTimerEx("TimePlayerLogged", 1000, true, "i", playerid);
}
else
{
SendMsg(playerid, RED, "*Error: Wrong Password. Password Did Not Match With The One You Have Register With.");
}
}
}
else
{
new loginstring[128];
new loginname[64];
GetPlayerName(playerid,loginname,sizeof(loginname));
format(loginstring,sizeof(loginstring),"ERROR: Incorrect password!\n \nPlease enter the correct password:",loginname);
ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Cancel");
gPlayerLogTries[playerid] += 1;
if(gPlayerLogTries[playerid] == 3) { Kick(playerid); }
}
}
if(dialogid == 2 || dialogid == 12345)
{
new ppw[20], str[128];
format(pfile, sizeof(pfile), pfile_path, Playername(playerid));
if(sscanf(params, "s", ppw)) return SendMsg(playerid, RED, "*USAGE: /register [password] - Max length is 20 & minium is 3");
else if(strlen(ppw) < 3) return SendMsg(playerid, RED, "*Error: Password Is Under The Limit Sorry");
else if(strlen(ppw) > 20) return SendMsg(playerid, RED, "*Error: Password Is Over The Limit Sorry");
else if(IsLogged[playerid] == 1) return SendMsg(playerid, RED, "*Error: You Are Logged In | No Need To Register Again!");
else if(dini_Exists(pfile)) return SendMsg(playerid, RED, "*Error: This Username Is Already Registered In Our Database Please Login! Or Create A Different Account");
else
{
format(pfile, sizeof(pfile), pfile_path, Playername(playerid));
dini_Create(pfile);
dini_Set(pfile, "Password", ppw);
dini_IntSet(pfile, "Score", 0);
dini_IntSet(pfile, "Money", 0);
dini_IntSet(pfile, "AdminLevel", 0);
dini_IntSet(pfile, "Hourslogged", 0);
dini_IntSet(pfile, "MinutesLogged", 0);
dini_IntSet(pfile, "SecondsLogged", 0);
dini_IntSet(pfile, "WantedLevel", 0);
format(str, sizeof(str), "*Success: You Has Successfully Registered %s And With The Password Of %s", Playername(playerid), ppw);
SendMsg(playerid, GREEN, str);
}
}
else
{
new regstring[128];
new regname[64];
GetPlayerName(playerid,regname,sizeof(regname));
format(regstring,sizeof(regstring),"Welcome, %s\nYou dont have an account.\nPlease register:",regname);
ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Register",regstring,"Register","Cancel");
}
}
return 1;
}
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
gPlayerClass[playerid] = classid;
SetPlayerTeamFromClass(playerid, classid);
SetPlayerColor(playerid,0xAFAFAFAA);
SetPlayerPos(playerid, 2089.360107, 1683.240722, 10.820312);
SetPlayerFacingAngle(playerid, 90.595680);
SetPlayerCameraLookAt(playerid, 2089.360107, 1683.240722, 10.820312);
SetPlayerCameraPos(playerid, 2089.360107 + (5 * floatsin(-90.595680, degrees)), 1683.240722 + (5 * floatcos(-90.595680, degrees)), 10.820312);
PlayerPlaySound(playerid, 1097,-119.9460,23.1096,12.2238); //music, duh
// LOGIN AND REGISTER
new string[128];
format(pfile, sizeof(pfile), pfile_path, Playername(playerid));
if(dini_Exists(pfile))
{
format(string,sizeof(string),"Welcome Back %s to New York City Life Cops And Robbers. \n \nYour name is registered.\nPlease enter your password below:",Playername(playerid));
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login",string,"Login","Cancel");
}
else
{
format(string,sizeof(string),"Welcome to New York City Life Cops And Robbers. \n \nYour name is Not registered.\nPlease enter your password & Register A New Account below:",Playername(playerid));
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Login",string,"Register","Cancel");
}
return 1;
}
pawn Код:
C:\DOCUME~1\Karim\MYDOCU~1\GRANDT~1\SA-MPS~1\GAMEMO~1\COPSAR~1.pwn(1841) : error 017: undefined symbol "params"
C:\DOCUME~1\Karim\MYDOCU~1\GRANDT~1\SA-MPS~1\GAMEMO~1\COPSAR~1.pwn(1876) : warning 217: loose indentation
C:\DOCUME~1\Karim\MYDOCU~1\GRANDT~1\SA-MPS~1\GAMEMO~1\COPSAR~1.pwn(1880) : error 017: undefined symbol "params"
C:\DOCUME~1\Karim\MYDOCU~1\GRANDT~1\SA-MPS~1\GAMEMO~1\COPSAR~1.pwn(1911) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
2 Errors.
pawn Код:
if(sscanf(params, "s", ppw)) return SendMsg(playerid, RED, "*USAGE: /login [password]");