PDA

View Full Version : Dialog Help!


aaleks123
28/12/2013, 06:04 PM
FIXED:)

Hey!

Im kinda having trouble with people doing the command:

CMD:rpguide(playerid,params[])
{
if(IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GRAD1,"You need to be logged in to use that command!");
ShowPlayerDialog(playerid,DIALOG_RPGUIDE,DIALOG_ST YLE_LIST,"RP-Guide","What is Roleplay?\nRoleplay Rules\nRoleplay Commands","Open","Close");
return 1;
}


Something in my Dialog Response is wrong making ALL script errors pop up.
Errors:

C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(98) : error 017: undefined symbol "UserPath"
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(100) : error 017: undefined symbol "UserPath"
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(111) : warning 235: public function lacks forward declaration (symbol "SendAdminMessage")
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(157) : warning 217: loose indentation
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(157) : error 079: inconsistent return types (array & non-array)
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(159) : warning 217: loose indentation
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(183) : error 017: undefined symbol "SaveAccountStats"
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(189) : error 079: inconsistent return types (array & non-array)
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(216) : error 079: inconsistent return types (array & non-array)
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(219) : error 079: inconsistent return types (array & non-array)
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(220) : error 017: undefined symbol "UserPath"
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(222) : error 017: undefined symbol "udb_hash"
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(240) : error 079: inconsistent return types (array & non-array)
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(243) : error 017: undefined symbol "udb_hash"
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(245) : error 017: undefined symbol "UserPath"
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(261) : error 079: inconsistent return types (array & non-array)
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(263) : warning 217: loose indentation
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(263) : error 079: inconsistent return types (array & non-array)
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(265) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(265) : error 004: function "OnPlayerSpawn" is not implemented
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(270) : error 017: undefined symbol "SetPlayerToTeamColor"
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(280) : error 079: inconsistent return types (array & non-array)
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(283) : warning 225: unreachable code
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(283) : error 029: invalid expression, assumed zero
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(283) : error 004: function "OnPlayerText" is not implemented
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(295) : error 017: undefined symbol "RPName"
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(296) : error 017: undefined symbol "ProxDetector"
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(315) : error 017: undefined symbol "RPName"
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(316) : error 017: undefined symbol "ProxDetector"
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(318) : error 079: inconsistent return types (array & non-array)
C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(321) : error 079: inconsistent return types (array & non-array)

My Public OnDialogResponse area:

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_RPGUIDE)
{
if(response)
{
if(listitem == 0)
{
SendClientMessage(playerid,COLOR_RED,"__________What is Roleplay?__________");
SendClientMessage(playerid,COLOR_RED,"Roleplay is when you act out situations as");
SendClientMessage(playerid,COLOR_RED,"the were real life situations!");
}
if(listitem == 1)
{
SendClientMessage(playerid,COLOR_RED,"__________Roleplay Rules__________");
SendClientMessage(playerid,COLOR_RED,"CHANGEME CHANGEME CHANGEME CHANGEME");
}
if(listitem == 2)
{
SendClientMessage(playerid,COLOR_RED,"__________Roleplay Commands__________");
SendClientMessage(playerid,COLOR_RED," /me | /do | /accent");
}
return 1;
}
if(dialogid == DIALOG_AGE)
{
if(!response)
{
Kick(playerid);
}
else
{
if(strlen(inputtext))
{
new age = strval(inputtext);
if(age > 100 || age < 16)
{
ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "- Age -","How old are you??\n{FF0000}(( 16 - 100 ))","Answer","Quit");
}
else
{
PlayerInfo[playerid][pAge] = age;
new
string[ 64 ]
;
format(string, sizeof(string), "INFO: You're {3BB9FF}%d years old.",age);
SendClientMessage(playerid, -1, string);
GivePlayerCash(playerid, 600);
SaveAccountStats(playerid);
SpawnPlayer(playerid);
}
}
else
{
return 0;
}
}
}
if(dialogid == DIALOG_SEX)
{
if(response)
{
PlayerInfo[playerid][pSex] = 1;
SendClientMessage(playerid, -1, "INFO: You are {3BB9FF}male.");
SetPlayerSkin(playerid, 60);
PlayerInfo[playerid][pSkin] = 60;
ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "- Age -","How old are you??\n{FF0000}(( 16 - 100 ))","Answer","Quit");
}
else
{
PlayerInfo[playerid][pSex] = 2;
SendClientMessage(playerid, -1, "INFO: You are {3BB9FF}female.");
SetPlayerSkin(playerid, 233);
PlayerInfo[playerid][pSkin] = 233;
ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "- Age -","How old are you??\n{FF0000}(( 16 - 100 ))","Answer","Quit");
}
}
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registering...","You have entered an invalid password.\nType your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Sex",0);
INI_WriteInt(File,"Age",0);
INI_WriteFloat(File,"PosX",0);
INI_WriteFloat(File,"PosY",0);
INI_WriteFloat(File,"PosZ",0);
INI_WriteInt(File,"Skin",0);
INI_WriteInt(File,"Team",0);
INI_WriteInt(File,"Accent",0);
INI_Close(File);

ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_MSGBOX, "- Sex -","What gender are you?","Male","Female");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
new
tmp2[ 256 ],
playername2[ MAX_PLAYER_NAME ]
;
GetPlayerName(playerid, playername2, sizeof(playername2));
format(tmp2, sizeof(tmp2), "~w~Welcome ~n~~g~%s", playername2);
GameTextForPlayer(playerid, tmp2, 5000, 1);
SetTimerEx("UnsetFirstSpawn", 5000, false, "i", playerid);
GivePlayerCash(playerid, PlayerInfo[playerid][pCash]);
SetSpawnInfo(playerid, PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosY], PlayerInfo[playerid][pPosZ], 1.0, -1, -1, -1, -1, -1, -1);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
}
return 1;
}
return 0;
}


Thanks!

nmader
28/12/2013, 06:20 PM
Try this:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_RPGUIDE)
{
if(response)
{
if(listitem == 0)
{
SendClientMessage(playerid,COLOR_RED,"__________What is Roleplay?__________");
SendClientMessage(playerid,COLOR_RED,"Roleplay is when you act out situations as");
SendClientMessage(playerid,COLOR_RED,"the were real life situations!");
}
if(listitem == 1)
{
SendClientMessage(playerid,COLOR_RED,"__________Roleplay Rules__________");
SendClientMessage(playerid,COLOR_RED,"CHANGEME CHANGEME CHANGEME CHANGEME");
}
if(listitem == 2)
{
SendClientMessage(playerid,COLOR_RED,"__________Roleplay Commands__________");
SendClientMessage(playerid,COLOR_RED," /me | /do | /accent");
}
}
return 1;
}
if(dialogid == DIALOG_AGE)
{
if(!response)
{
Kick(playerid);
}
else
{
if(strlen(inputtext))
{
new age = strval(inputtext);
if(age > 100 || age < 16)
{
ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "- Age -","How old are you??\n{FF0000}(( 16 - 100 ))","Answer","Quit");
}
else
{
PlayerInfo[playerid][pAge] = age;
new
string[ 64 ];
format(string, sizeof(string), "INFO: You're {3BB9FF}%d years old.",age);
SendClientMessage(playerid, -1, string);
GivePlayerCash(playerid, 600);
SaveAccountStats(playerid);
SpawnPlayer(playerid);
}
}
else
{
return 0;
}
}
}
if(dialogid == DIALOG_SEX)
{
if(response)
{
PlayerInfo[playerid][pSex] = 1;
SendClientMessage(playerid, -1, "INFO: You are {3BB9FF}male.");
SetPlayerSkin(playerid, 60);
PlayerInfo[playerid][pSkin] = 60;
ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "- Age -","How old are you??\n{FF0000}(( 16 - 100 ))","Answer","Quit");
}
else
{
PlayerInfo[playerid][pSex] = 2;
SendClientMessage(playerid, -1, "INFO: You are {3BB9FF}female.");
SetPlayerSkin(playerid, 233);
PlayerInfo[playerid][pSkin] = 233;
ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "- Age -","How old are you??\n{FF0000}(( 16 - 100 ))","Answer","Quit");
}
}
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registering...","You have entered an invalid password.\nType your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Sex",0);
INI_WriteInt(File,"Age",0);
INI_WriteFloat(File,"PosX",0);
INI_WriteFloat(File,"PosY",0);
INI_WriteFloat(File,"PosZ",0);
INI_WriteInt(File,"Skin",0);
INI_WriteInt(File,"Team",0);
INI_WriteInt(File,"Accent",0);
INI_Close(File);

ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_MSGBOX, "- Sex -","What gender are you?","Male","Female");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
new
tmp2[ 256 ],
playername2[ MAX_PLAYER_NAME ]
;
GetPlayerName(playerid, playername2, sizeof(playername2));
format(tmp2, sizeof(tmp2), "~w~Welcome ~n~~g~%s", playername2);
GameTextForPlayer(playerid, tmp2, 5000, 1);
SetTimerEx("UnsetFirstSpawn", 5000, false, "i", playerid);
GivePlayerCash(playerid, PlayerInfo[playerid][pCash]);
SetSpawnInfo(playerid, PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosY], PlayerInfo[playerid][pPosZ], 1.0, -1, -1, -1, -1, -1, -1);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
}
return 1;
}
return 0;
You didn't have a bracket closed, so it gave you 26 errors, be a bit more cautious about this. This even challenges me at times.

aaleks123
28/12/2013, 06:25 PM
I have done that and still 26 Errors.

Battlezone
28/12/2013, 06:30 PM
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_RPGUIDE)
{
if(response)
{
if(listitem == 0)
{
SendClientMessage(playerid,COLOR_RED,"__________What is Roleplay?__________");
SendClientMessage(playerid,COLOR_RED,"Roleplay is when you act out situations as");
SendClientMessage(playerid,COLOR_RED,"the were real life situations!");
}
if(listitem == 1)
{
SendClientMessage(playerid,COLOR_RED,"__________Roleplay Rules__________");
SendClientMessage(playerid,COLOR_RED,"CHANGEME CHANGEME CHANGEME CHANGEME");
}
if(listitem == 2)
{
SendClientMessage(playerid,COLOR_RED,"__________Roleplay Commands__________");
SendClientMessage(playerid,COLOR_RED," /me | /do | /accent");
}
return 1;
}
} // you forgot this
if(dialogid == DIALOG_AGE)
{
if(!response)
{
Kick(playerid);
}
if(response)
{
if(strlen(inputtext))
{
new age = strval(inputtext);
if(age > 100 || age < 16)
{
ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "- Age -","How old are you??\n{FF0000}(( 16 - 100 ))","Answer","Quit");
}
else
{
PlayerInfo[playerid][pAge] = age;
new
string[ 64 ]
;
format(string, sizeof(string), "INFO: You're {3BB9FF}%d years old.",age);
SendClientMessage(playerid, -1, string);
GivePlayerCash(playerid, 600);
SaveAccountStats(playerid);
SpawnPlayer(playerid);
}
}
else
{
return 0;
}
}
}
if(dialogid == DIALOG_SEX)
{
if(response)
{
PlayerInfo[playerid][pSex] = 1;
SendClientMessage(playerid, -1, "INFO: You are {3BB9FF}male.");
SetPlayerSkin(playerid, 60);
PlayerInfo[playerid][pSkin] = 60;
ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "- Age -","How old are you??\n{FF0000}(( 16 - 100 ))","Answer","Quit");
}
else
{
PlayerInfo[playerid][pSex] = 2;
SendClientMessage(playerid, -1, "INFO: You are {3BB9FF}female.");
SetPlayerSkin(playerid, 233);
PlayerInfo[playerid][pSkin] = 233;
ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "- Age -","How old are you??\n{FF0000}(( 16 - 100 ))","Answer","Quit");
}
}
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registering...","You have entered an invalid password.\nType your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Sex",0);
INI_WriteInt(File,"Age",0);
INI_WriteFloat(File,"PosX",0);
INI_WriteFloat(File,"PosY",0);
INI_WriteFloat(File,"PosZ",0);
INI_WriteInt(File,"Skin",0);
INI_WriteInt(File,"Team",0);
INI_WriteInt(File,"Accent",0);
INI_Close(File);

ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_MSGBOX, "- Sex -","What gender are you?","Male","Female");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
new
tmp2[ 256 ],
playername2[ MAX_PLAYER_NAME ]
;
GetPlayerName(playerid, playername2, sizeof(playername2));
format(tmp2, sizeof(tmp2), "~w~Welcome ~n~~g~%s", playername2);
GameTextForPlayer(playerid, tmp2, 5000, 1);
SetTimerEx("UnsetFirstSpawn", 5000, false, "i", playerid);
GivePlayerCash(playerid, PlayerInfo[playerid][pCash]);
SetSpawnInfo(playerid, PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosY], PlayerInfo[playerid][pPosZ], 1.0, -1, -1, -1, -1, -1, -1);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
}
return 1;
}
return 0;
}

xVIP3Rx
28/12/2013, 06:39 PM
I would like if you post/gave me the whole script I'll because there are errors out of OnDialogResponse

aaleks123
28/12/2013, 06:41 PM
So I added both of yours and same answer for both.

Error: 1 Error only!

C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(265) : error 002: only a single statement (or expression) can follow each "case"

What I put at the end of the whole thing:

return 1;
}
}
return 0;
}


The section that I have now:

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_RPGUIDE)
{
if(response)
{
if(listitem == 0)
{
SendClientMessage(playerid,COLOR_RED,"__________What is Roleplay?__________");
SendClientMessage(playerid,COLOR_RED,"Roleplay is when you act out situations as");
SendClientMessage(playerid,COLOR_RED,"the were real life situations!");
}
if(listitem == 1)
{
SendClientMessage(playerid,COLOR_RED,"__________Roleplay Rules__________");
SendClientMessage(playerid,COLOR_RED,"CHANGEME CHANGEME CHANGEME CHANGEME");
}
if(listitem == 2)
{
SendClientMessage(playerid,COLOR_RED,"__________Roleplay Commands__________");
SendClientMessage(playerid,COLOR_RED," /me | /do | /accent");
}
return 1;
}
} // you forgot this
if(dialogid == DIALOG_AGE)
{
if(!response)
{
Kick(playerid);
}
if(response)
{
if(strlen(inputtext))
{
new age = strval(inputtext);
if(age > 100 || age < 16)
{
ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "- Age -","How old are you??\n{FF0000}(( 16 - 100 ))","Answer","Quit");
}
else
{
PlayerInfo[playerid][pAge] = age;
new
string[ 64 ]
;
format(string, sizeof(string), "INFO: You're {3BB9FF}%d years old.",age);
SendClientMessage(playerid, -1, string);
GivePlayerCash(playerid, 600);
SaveAccountStats(playerid);
SpawnPlayer(playerid);
}
}
else
{
return 0;
}
}
}
if(dialogid == DIALOG_SEX)
{
if(response)
{
PlayerInfo[playerid][pSex] = 1;
SendClientMessage(playerid, -1, "INFO: You are {3BB9FF}male.");
SetPlayerSkin(playerid, 60);
PlayerInfo[playerid][pSkin] = 60;
ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "- Age -","How old are you??\n{FF0000}(( 16 - 100 ))","Answer","Quit");
}
else
{
PlayerInfo[playerid][pSex] = 2;
SendClientMessage(playerid, -1, "INFO: You are {3BB9FF}female.");
SetPlayerSkin(playerid, 233);
PlayerInfo[playerid][pSkin] = 233;
ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "- Age -","How old are you??\n{FF0000}(( 16 - 100 ))","Answer","Quit");
}
}
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registering...","You have entered an invalid password.\nType your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Sex",0);
INI_WriteInt(File,"Age",0);
INI_WriteFloat(File,"PosX",0);
INI_WriteFloat(File,"PosY",0);
INI_WriteFloat(File,"PosZ",0);
INI_WriteInt(File,"Skin",0);
INI_WriteInt(File,"Team",0);
INI_WriteInt(File,"Accent",0);
INI_Close(File);

ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_MSGBOX, "- Sex -","What gender are you?","Male","Female");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
new
tmp2[ 256 ],
playername2[ MAX_PLAYER_NAME ]
;
GetPlayerName(playerid, playername2, sizeof(playername2));
format(tmp2, sizeof(tmp2), "~w~Welcome ~n~~g~%s", playername2);
GameTextForPlayer(playerid, tmp2, 5000, 1);
SetTimerEx("UnsetFirstSpawn", 5000, false, "i", playerid);
GivePlayerCash(playerid, PlayerInfo[playerid][pCash]);
SetSpawnInfo(playerid, PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosY], PlayerInfo[playerid][pPosZ], 1.0, -1, -1, -1, -1, -1, -1);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
}
return 1;
}
}
return 0;
}

Battlezone
28/12/2013, 06:43 PM
I understand from the error that after CASE you must put a number, like CASE 1: but not case DIALOG_LOGIN:
so change DIALOG_LOGIN with his id

xVIP3Rx
28/12/2013, 06:45 PM
#define PATH "/Users/%s.ini"

enum
{
DIALOG_REGISTER,
DIALOG_LOGIN,
DIALOG_RPGUIDE,
DIALOG_AGE,
DIALOG_SEX,
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_RPGUIDE:
{
if(!response) return 1;

switch(listitem)
{
case 0:
{
SendClientMessage(playerid,COLOR_RED,"__________What is Roleplay?__________");
SendClientMessage(playerid,COLOR_RED,"Roleplay is when you act out situations as");
SendClientMessage(playerid,COLOR_RED,"the were real life situations!");
}
case 1:
{
SendClientMessage(playerid,COLOR_RED,"__________Roleplay Rules__________");
SendClientMessage(playerid,COLOR_RED,"CHANGEME CHANGEME CHANGEME CHANGEME");
}
case 2:
{
SendClientMessage(playerid,COLOR_RED,"__________Roleplay Commands__________");
SendClientMessage(playerid,COLOR_RED," /me | /do | /accent");
}
}
return 1;
}
case DIALOG_AGE:
{
if(!response) return Kick(playerid);
if(!strlen(inputtext)) return 1;

new age = strval(inputtext);
if(age > 100 || age < 16) return ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "- Age -","How old are you??\n{FF0000}(( 16 - 100 ))","Answer","Quit");

PlayerInfo[playerid][pAge] = age;
new string[64];
format(string, sizeof(string), "INFO: You're {3BB9FF}%d years old.",age);
SendClientMessage(playerid, -1, string);
GivePlayerCash(playerid, 600);
SaveAccountStats(playerid);
SpawnPlayer(playerid);
return 1;
}
case DIALOG_SEX:
{
if(response)
{
PlayerInfo[playerid][pSex] = 1;
SendClientMessage(playerid, -1, "INFO: You are {3BB9FF}male.");
SetPlayerSkin(playerid, 60);
}
else
{
PlayerInfo[playerid][pSex] = 2;
SendClientMessage(playerid, -1, "INFO: You are {3BB9FF}female.");
SetPlayerSkin(playerid, 233);
}
PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
return ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "- Age -","How old are you??\n{FF0000}(( 16 - 100 ))","Answer","Quit");
}
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);

if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registering...","You have entered an invalid password.\nType your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Sex",0);
INI_WriteInt(File,"Age",0);
INI_WriteFloat(File,"PosX",0);
INI_WriteFloat(File,"PosY",0);
INI_WriteFloat(File,"PosZ",0);
INI_WriteInt(File,"Skin",0);
INI_WriteInt(File,"Team",0);
INI_WriteInt(File,"Accent",0);
INI_Close(File);

return ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_MSGBOX, "- Sex -","What gender are you?","Male","Female");
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );

if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
new
tmp2[ 256 ],
playername2[ MAX_PLAYER_NAME ]
;
GetPlayerName(playerid, playername2, sizeof(playername2));
format(tmp2, sizeof(tmp2), "~w~Welcome ~n~~g~%s", playername2);
GameTextForPlayer(playerid, tmp2, 5000, 1);
SetTimerEx("UnsetFirstSpawn", 5000, false, "i", playerid);
GivePlayerCash(playerid, PlayerInfo[playerid][pCash]);
SetSpawnInfo(playerid, PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosY], PlayerInfo[playerid][pPosZ], 1.0, -1, -1, -1, -1, -1, -1);
}
else ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");

return 1;
}
}
return 0;
}

stock UserPath(playerid)
{
new string[40], playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playernam e));
format(string,sizeof(string),PATH,playername);
return string;
}
/*Credits to Dracoblue*/
stock udb_hash(buf[])
{
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}
If you found any errors, Then please post the whole script (e.g Gamemode/Filterscript )

aaleks123
28/12/2013, 06:48 PM
Am I supposed to put the

stock UserPath(playerid)
{
new string[40], playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playernam e));
format(string,sizeof(string),PATH,playername);
return string;
}
/*Credits to Dracoblue*/
stock udb_hash(buf[])
{
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}


Aswell?

xVIP3Rx
28/12/2013, 06:49 PM
Yes. You're missing them, and if it didn't work please post the whole code

aaleks123
28/12/2013, 06:54 PM
Sick it worked!

By the way, I already had those last items, It gave me errors that its already defined.
1 Error ONLY left from the enum part.

Error:

C:\Users\Aleks\Desktop\County Roleplay\gamemodes\Changeme.pwn(78) : error 001: expected token: "-identifier-", but found "-integer value-"


Line:


enum
{
DIALOG_REGISTER, <--- Line 78
DIALOG_LOGIN,
DIALOG_RPGUIDE,
DIALOG_AGE,
DIALOG_SEX,
}

aaleks123
28/12/2013, 07:09 PM
Can anyone help ^ ?

aaleks123
28/12/2013, 07:16 PM
Fixed! I put for the enum


enum
{
DIALOGREGISTER,
DIALOGLOGIN,
DIALOGRPGUIDE,
DIALOGAGE,
DIALOGSEX,
}



Instead of


enum
{
DIALOG_REGISTER
DIALOG_LOGIN
DIALOG_RPGUIDE
DIALOG_AGE
DIALOG_SEX
}


Error is gone.

xVIP3Rx
28/12/2013, 07:17 PM
Fixed! I put for the enum


enum
{
DIALOGREGISTER,
DIALOGLOGIN,
DIALOGRPGUIDE,
DIALOGAGE,
DIALOGSEX,
}


Happy for you.. But you didn't change anything at all :o
anyway I think you should add ";" at the end..

enum
{
DIALOGREGISTER,
DIALOGLOGIN,
DIALOGRPGUIDE,
DIALOGAGE,
DIALOGSEX,
};

EDIT: The problem was at your first code.. Anyway good job!

aaleks123
28/12/2013, 07:20 PM
Alright thanks!