Slight problem. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Slight problem. (
/showthread.php?tid=350518)
Slight problem. - Nicholas. - 12.06.2012
Alright.
In my gamemode I am using the new clickable textdraw feature. I have created two textdraws which will act as the login and registration buttons. When clicked on either of the textdraws the dialog should pop up. My problem is that it is skipping OnPlayerConnect and going straight to OnPlayerRequestClass when connected to the server.
Here's my OnPlayerRequestClass.
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerInterior(playerid,11);
SetPlayerPos(playerid,508.7362,-87.4335,998.9609);
SetPlayerFacingAngle(playerid,0.0);
SetPlayerCameraPos(playerid,508.7362,-83.4335,998.9609);
SetPlayerCameraLookAt(playerid,508.7362,-87.4335,998.9609);
TextDrawHideForPlayer(playerid, Login);
TextDrawHideForPlayer(playerid, Register);
switch(classid)
{
case 0:
{
SetPlayerTeam(playerid, ----);
TextDrawShowForPlayer(playerid, ----);
TextDrawHideForPlayer(playerid, ----);
TextDrawHideForPlayer(playerid, ----);
}
case 1:
{
SetPlayerTeam(playerid, ----);
TextDrawShowForPlayer(playerid, -----);
TextDrawHideForPlayer(playerid, -----);
TextDrawHideForPlayer(playerid, -----);
}
case 2:
{
SetPlayerTeam(playerid, -----);
TextDrawShowForPlayer(playerid, -----);
TextDrawHideForPlayer(playerid, -----);
TextDrawHideForPlayer(playerid, -------;
}
case 3:
{
SetPlayerTeam(playerid, -------);
TextDrawShowForPlayer(playerid, ------);
TextDrawHideForPlayer(playerid, -----);
TextDrawHideForPlayer(playerid, ------);
}
case 4:
{
SetPlayerTeam(playerid, ------);
TextDrawShowForPlayer(playerid, -----);
TextDrawHideForPlayer(playerid, -----);
TextDrawHideForPlayer(playerid, -----);
}
}
return 1;
}
Here's my OnPlayerConnect.
pawn Код:
public OnPlayerConnect(playerid)
{
TextDrawShowForPlayer(playerid, Top);
TextDrawShowForPlayer(playerid, Bottom);
TextDrawShowForPlayer(playerid, Login);
TextDrawShowForPlayer(playerid, Register);
return 1;
}
and OnPlayerClickTextDraw....
pawn Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
if(_:clickedid != INVALID_TEXT_DRAW)
{
if(clickedid == Register)
{
if(fexist (UserPath (playerid)))
{
SendClientMessage( playerid, -1, ""COL_ORANGE"INFO:"COL_LIGHTBLUE"You already have an account registered.");
}
else if( !fexist (UserPath (playerid)))
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,""COL_LIGHTBLUE"Registration",""COL_WHITE"Welcome to \nPlease fill in a password to register your account.","Register","Quit");
}
}
else if( clickedid == Login)
{
if( fexist (UserPath (playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_LIGHTBLUE"Login",""COL_WHITE"Welcome back to \nPlease fill in your password to login to your account.","Login","Quit");
}
else if( !fexist (UserPath (playerid)))
{
SendClientMessage( playerid, -1, ""COL_ORANGE"INFO:"COL_LIGHTBLUE"You do not have an account registered.");
}
}
}
return 1;
}
Re: Slight problem. -
Forman - 12.06.2012
Same here!
Re: Slight problem. -
Chris1337 - 12.06.2012
Use This
pawn Код:
forward SetupPlayerForClassSelection(playerid, classid);