11.06.2012, 21:02
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response) {
switch(dialogid) // We switch our dialog id's
{
case DIALOG_REGISTER: // If the dialog_register shows up ( id 1111)
{
if(!response) Kick(playerid); // If he click on Quit, he will get kicked
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Please register!","{FFFFFF}Type your {00FF22}password {FFFFFF}here to register.","Register","Quit");
// If he doesn't type anything, the dialog will show again.
if(response) // If he click on Register
{
new file[64]; // We declare the size of the file
GetPlayerName(playerid,file,sizeof(file)); // We get the file name
format(file,sizeof(file),DOF2_File(file)); // We get the path name from DOF2_File, that means from Users folder.
DOF2_CreateFile(file, inputtext); // Creates the file and the password.
DOF2_SetInt(file, "Kills", 0); // When the player register his kills will be set to 0, you can change
DOF2_SetInt(file, "Deaths", 0); // His deaths will be set to 0, you can change
DOF2_SetInt(file, "Money", 1000); // His money will be set to 1000, you can change
DOF2_SetInt(file, "AdminLevel", 0); // His Admin Level will be set to 0, you can change
DOF2_SaveFile(); // Saves the file.
SetSpawnInfo(playerid, 0, 0, 1722.5123, -1912.7931, 13.5647, 269.15, 0, 0, 0, 0, 0, 0); // Sets where the player will spawn, this coordinates are from the Unity Station in Los Santos
SpawnPlayer(playerid); // After registering, the player will spawn.
}
}
case DIALOG_LOGIN: // If dialog_login (id 2222) shows up
{
if(!response) Kick(playerid); // If he click on Quit, he will get kicked.
if(response) // If he click on Log-in
{
new file[64]; // We declare the size of the file
GetPlayerName(playerid,file,sizeof(file)); // We get the file name
format(file,sizeof(file),DOF2_File(file)); // We get the user path from DOF2_File ( folder Users )
if(DOF2_FileExists(file)) // If he is registered
{
if(DOF2_CheckLogin(file,inputtext)) // We check if the password match
{
PlayerInfo[playerid][pKills] = DOF2_GetInt(file,"Kills"); // We load our settings
PlayerInfo[playerid][pDeaths] = DOF2_GetInt(file,"Deaths");
PlayerInfo[playerid][pMoney] = DOF2_GetInt(file,"Money");
PlayerInfo[playerid][pAdmin] = DOF2_GetInt(file,"AdminLevel");
SetSpawnInfo(playerid, 0, 0, 1722.5123, -1912.7931, 13.5647, 269.15, 0, 0, 0, 0, 0, 0); // We set the spawn (Unity Station)
SpawnPlayer(playerid); // The player spawns after log-in
GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]); // We give the player his money
return 1;
}
else // If the password don't match, they will get an error
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Wrong Password!","{F81414}You have typed a wrong password\n{FFFFFF}Type your password here to log-in!","Log-in","Quit");
return 1;
}
} // If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
case Dialog_Escolha: // Our dialog!
{
switch(listitem) { // Checking which listitem was selected
case 0: // The first item listed
{
SetPlayerTeam(playerid,1);
SpawnPlayer(playerid);
Equipes[playerid] = 1;
SetPlayerSkin(playerid, 14);
SendClientMessage(playerid, 0xFFFFFFFF, "Certo,Vocк escolheu ser Humano!");
}
case 1: // The second item listed
{
SetPlayerTeam(playerid,2);
SpawnPlayer(playerid);
Equipes[playerid] = 2;
SetPlayerSkin(playerid, 14);
SendClientMessage(playerid, 0xFFFFFFFF, "Certo,Vocк escolheu ser Zombie");
}
}
return 1;
}
}
}
return 1;
}
pawn Код:
case Dialog_Escolha: // Our dialog!
{
pawn Код:
C:\Users\Lucas Lopes\Desktop\Server Samp\gamemodes\S4D.pwn(420) : warning 217: loose indentation
C:\Users\Lucas Lopes\Desktop\Server Samp\gamemodes\S4D.pwn(420) : error 014: invalid statement; not in switch
C:\Users\Lucas Lopes\Desktop\Server Samp\gamemodes\S4D.pwn(420) : warning 215: expression has no effect
C:\Users\Lucas Lopes\Desktop\Server Samp\gamemodes\S4D.pwn(420) : error 001: expected token: ";", but found ":"
C:\Users\Lucas Lopes\Desktop\Server Samp\gamemodes\S4D.pwn(420) : error 029: invalid expression, assumed zero
C:\Users\Lucas Lopes\Desktop\Server Samp\gamemodes\S4D.pwn(420) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.