Continue in somewhere down in a callback - 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: Continue in somewhere down in a callback (
/showthread.php?tid=281516)
Continue in somewhere down in a callback -
Wesley221 - 06.09.2011
Hey guys,
I have a 'config' command, which sets some things for the server. But now i want a admin config, and a normal person config. I know you can just do 'if( adminthing == 5 )', and if youre not a level 5 admin it shows you a message. But i want it that it shows the dialog, but not the admin dialog.
pawn Код:
YCMD:config(playerid, params[], help)
{
#pragma unused help
if( !strcmp(params, "admin", true ) )
{
if( AIsPlayerHeadAdmin( playerid ) )
{
} else continue at Notadmin; // when youre not an head admin, it continues at 'Notadmin'
}
else
{
Notadmin // Notadmin is right here, and it should continue to those things down
new Info[256], UOW[14], RPM[14];
switch( WeaponInfo[playerid][pUseOwn] )
{
case 0: UOW = ""C_RED"false";
case 1: UOW = ""C_GREEN"true";
}
switch( PlayerInfo[playerid][pReceivePM] )
{
case 0: RPM = ""C_RED"false";
case 1: RPM = ""C_GREEN"true";
}
format( Info, sizeof Info, ""C_WHITE"Use own weapons: %s \n"C_WHITE"Receive pm's: %s", UOW, RPM );
ShowPlayerDialog(playerid, CONFIGEDIT, DIALOG_STYLE_LIST, "Configuration Dialog", Info, "Change", "Save");
}
return 1;
}
It should be possible, and i know a way how it can be done, but is there a complexer way to do this?
The thing what i had in mind was:
pawn Код:
YCMD:config(playerid, params[], help)
{
#pragma unused help
if( !strcmp(params, "admin", true ) )
{
if( AIsPlayerHeadAdmin( playerid ) )
{
}
else
{
new Info[256], UOW[14], RPM[14];
switch( WeaponInfo[playerid][pUseOwn] )
{
case 0: UOW = ""C_RED"false";
case 1: UOW = ""C_GREEN"true";
}
switch( PlayerInfo[playerid][pReceivePM] )
{
case 0: RPM = ""C_RED"false";
case 1: RPM = ""C_GREEN"true";
}
format( Info, sizeof Info, ""C_WHITE"Use own weapons: %s \n"C_WHITE"Receive pm's: %s", UOW, RPM );
ShowPlayerDialog(playerid, CONFIGEDIT, DIALOG_STYLE_LIST, "Configuration Dialog", Info, "Change", "Save");
}
}
else
{
new Info[256], UOW[14], RPM[14];
switch( WeaponInfo[playerid][pUseOwn] )
{
case 0: UOW = ""C_RED"false";
case 1: UOW = ""C_GREEN"true";
}
switch( PlayerInfo[playerid][pReceivePM] )
{
case 0: RPM = ""C_RED"false";
case 1: RPM = ""C_GREEN"true";
}
format( Info, sizeof Info, ""C_WHITE"Use own weapons: %s \n"C_WHITE"Receive pm's: %s", UOW, RPM );
ShowPlayerDialog(playerid, CONFIGEDIT, DIALOG_STYLE_LIST, "Configuration Dialog", Info, "Change", "Save");
}
return 1;
}
But as you can see, the command will be huge.
~Wesley
Re: Continue in somewhere down in a callback -
Jefff - 06.09.2011
https://sampwiki.blast.hk/wiki/Keywords:Statements#goto
Re: Continue in somewhere down in a callback -
Wesley221 - 06.09.2011
Quote:
Originally Posted by Jefff
|
Exactly what i was looking for!
Thanks