public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { new string[124]; switch(dialogid) { case 1: { if(!response) return Kick(playerid); if(strlen(inputtext) < 6 || strlen(inputtext) > 32) { SendClientMessage(playerid, COL_GREY, "Please enter a password that is greater than 6 characters or less than 32 characters."); ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Welcome to "ServerName"", "Enter your desired password below to sucessfully register.", "Continue", "Cancel"); return 1; } else { RegisterPlayer(playerid, inputtext); PlayerVar[playerid][Authenticated] = 1; format(PlayerVar[playerid][Name], MAX_PLAYER_NAME, GetPlayersNameWithUnderScore(playerid)); format(PlayerVar[playerid][Password], 32, "%s", inputtext); format(PlayerVar[playerid][Accent], 32, "American"); GetPlayerIp(playerid, PlayerVar[playerid][IP], 32); } } case 2: { if(!response) return Kick(playerid); format(string, sizeof(string), "PlayerAccounts/%s.ini", GetPlayersNameWithUnderScore(playerid)); if(fexist(string)) { if(!strcmp(PlayerVar[playerid][Password], inputtext , false)) { INI_ParseFile(string, "LoadPlayer_%s", .bExtra = true, .extra = playerid); PlayerVar[playerid][Authenticated] = 1; LoginPlayer(playerid); } else { SendClientMessage(playerid, COL_GREY, "The password you entered does not match, please reconnect for another try."); Kick(playerid); } } } } return 1; }
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == DIALOG_WEAPONS) { if(response) // If they clicked 'Select' or double-clicked a weapon { // Give them the weapon if(listitem == 0) // They selected the first item - Desert Eagle { GivePlayerWeapon(playerid, WEAPON_DEAGLE, 14); // Give them a desert eagle } if(listitem == 1) // They selected the second item - AK-47 { GivePlayerWeapon(playerid, WEAPON_AK47, 120); // Give them an AK-47 } if(listitem == 2) // They selected the third item - Desert Eagle { GivePlayerWeapon(playerid, WEAPON_SHOTGSPA, 28); // Give them a Combat Shotgun } } return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText. } return 0; // You MUST return 0 here! Just like OnPlayerCommandText. }
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new string[124];
switch(dialogid)
{
case 1:
{
if(!response) return Kick(playerid);
if(strlen(inputtext) < 6 || strlen(inputtext) > 32)
{
SendClientMessage(playerid, COL_GREY, "Please enter a password that is greater than 6 characters or less than 32 characters.");
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Welcome to "ServerName"", "Enter your desired password below to sucessfully register.", "Continue", "Cancel");
return 1;
}
else
{
RegisterPlayer(playerid, inputtext);
PlayerVar[playerid][Authenticated] = 1;
format(PlayerVar[playerid][Name], MAX_PLAYER_NAME, GetPlayersNameWithUnderScore(playerid));
format(PlayerVar[playerid][Password], 32, "%s", inputtext);
format(PlayerVar[playerid][Accent], 32, "American");
GetPlayerIp(playerid, PlayerVar[playerid][IP], 32);
}
}
case 2:
{
if(!response) return Kick(playerid);
format(string, sizeof(string), "PlayerAccounts/%s.ini", GetPlayersNameWithUnderScore(playerid));
if(fexist(string))
{
if(!strcmp(PlayerVar[playerid][Password], inputtext , false))
{
INI_ParseFile(string, "LoadPlayer_%s", .bExtra = true, .extra = playerid);
PlayerVar[playerid][Authenticated] = 1;
LoginPlayer(playerid);
}
else
{
SendClientMessage(playerid, COL_GREY, "The password you entered does not match, please reconnect for another try.");
Kick(playerid);
}
}
}
case DIALOG_WEAPONS:
{
if(response) // If they clicked 'Select' or double-clicked a weapon
{
// Give them the weapon
if(listitem == 0) // They selected the first item - Desert Eagle
{
GivePlayerWeapon(playerid, WEAPON_DEAGLE, 14); // Give them a desert eagle
}
if(listitem == 1) // They selected the second item - AK-47
{
GivePlayerWeapon(playerid, WEAPON_AK47, 120); // Give them an AK-47
}
if(listitem == 2) // They selected the third item - Desert Eagle
{
GivePlayerWeapon(playerid, WEAPON_SHOTGSPA, 28); // Give them a Combat Shotgun
}
}
}
}
return 1;
}
C:\Users\x3990.003\Desktop\samp server\gamemodes\PZ.pwn(1671) : error 008: must be a constant expression; assumed zero |
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { new string[124]; switch(dialogid) { case 1: { if(!response) return Kick(playerid); if(strlen(inputtext) < 6 || strlen(inputtext) > 32) { SendClientMessage(playerid, COL_GREY, "Please enter a password that is greater than 6 characters or less than 32 characters."); ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Welcome to "ServerName"", "Enter your desired password below to sucessfully register.", "Continue", "Cancel"); return 1; } else { RegisterPlayer(playerid, inputtext); PlayerVar[playerid][Authenticated] = 1; format(PlayerVar[playerid][Name], MAX_PLAYER_NAME, GetPlayersNameWithUnderScore(playerid)); format(PlayerVar[playerid][Password], 32, "%s", inputtext); format(PlayerVar[playerid][Accent], 32, "American"); GetPlayerIp(playerid, PlayerVar[playerid][IP], 32); } } case 2: { if(!response) return Kick(playerid); format(string, sizeof(string), "PlayerAccounts/%s.ini", GetPlayersNameWithUnderScore(playerid)); if(fexist(string)) { if(!strcmp(PlayerVar[playerid][Password], inputtext , false)) { INI_ParseFile(string, "LoadPlayer_%s", .bExtra = true, .extra = playerid); PlayerVar[playerid][Authenticated] = 1; LoginPlayer(playerid); } else { SendClientMessage(playerid, COL_GREY, "The password you entered does not match, please reconnect for another try."); Kick(playerid); } } } case DIALOG_SEARCH: { if(response) { if(listitem == 0) // WP crate { SendClientMessage(playerid, COL_GREY, "The weapon crate has been marked on your map."); } if(listitem == 1) // Grocery store { SendClientMessage(playerid, COL_GREY, "The grocery store has been marked on your map."); } if(listitem == 2) // Hospital { SendClientMessage(playerid, COL_GREY, "The hospital has been marked on your map."); } if(listitem == 3) // Fire department { SendClientMessage(playerid, COL_GREY, "The fire department has been marked on your map."); } } } } return 1; }
new DIALOG_SEARCH; ShowPlayerDialog(playerid, DIALOG_SEARCH, DIALOG_STYLE_LIST, "Search a location", "Weapon crate\nGrocery store\nHospital\nFire department", "Okay", "Cancel");
#define DIALOG_WEAPONS 1
#define DIALOG_SEARCH 2
...
enum
{
DIALOG_WEAPONS
DIALOG_SEARCH
...
}
new DIALOG_SEARCH = 1;
new DIALOG_WEAPONS = 2;
...
Dude you need to #define them or put them in a enum
like this: pawn Код:
|