SA-MP Forums Archive
Trying to create a faction for a command. - 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: Trying to create a faction for a command. (/showthread.php?tid=639773)



Trying to create a faction for a command. - Thanks - 23.08.2017

I'm trying to create a faction for a command but its not work why?

PHP код:
CMD:cmds(playeridparams[])
{
    if(
faction1[playerid] == 1)
    {
    
TextDrawShowForPlayer(playeridTextdraw66);
    
TextDrawShowForPlayer(playeridTextdraw67);
    
TextDrawShowForPlayer(playeridTextdraw68);
    
TextDrawShowForPlayer(playeridTextdraw69);
    
TextDrawShowForPlayer(playeridTextdraw70);
    
TextDrawShowForPlayer(playeridTextdraw71);
    
TextDrawShowForPlayer(playeridTextdraw72);
    
TextDrawShowForPlayer(playeridTextdraw73);
    
TextDrawShowForPlayer(playeridTextdraw74);
    
TextDrawShowForPlayer(playeridTextdraw75);
    
TextDrawShowForPlayer(playeridTextdraw76);
    
TextDrawShowForPlayer(playeridTextdraw77);
    
TextDrawShowForPlayer(playeridTextdraw78);
    
TextDrawShowForPlayer(playeridTextdraw79);
    
TextDrawShowForPlayer(playeridTextdraw80);
    
TextDrawShowForPlayer(playeridTextdraw81);
    
TextDrawShowForPlayer(playeridTextdraw82);
    
TextDrawShowForPlayer(playeridTextdraw83);
    
TextDrawShowForPlayer(playeridTextdraw84);
    
TextDrawShowForPlayer(playeridTextdraw85);
    
TextDrawShowForPlayer(playeridTextdraw86);
    
TextDrawShowForPlayer(playeridTextdraw87);
    
TextDrawShowForPlayer(playeridTextdraw88);
    
TextDrawShowForPlayer(playeridTextdraw89);
    
TextDrawShowForPlayer(playeridTextdraw90);
    
TextDrawShowForPlayer(playeridTextdraw91);
    
TextDrawShowForPlayer(playeridTextdraw92);
    
TextDrawShowForPlayer(playeridTextdraw93);
    
TextDrawShowForPlayer(playeridTextdraw94);
    
TextDrawShowForPlayer(playeridTextdraw95);
    
TextDrawShowForPlayer(playeridTextdraw96);
    
TextDrawShowForPlayer(playeridTextdraw97);
    
TextDrawShowForPlayer(playeridTextdraw98);
    
TextDrawShowForPlayer(playeridTextdraw99);
    
TextDrawShowForPlayer(playeridTextdraw100);
    
TextDrawShowForPlayer(playeridTextdraw101);
    
TextDrawShowForPlayer(playeridTextdraw102);
    
TextDrawShowForPlayer(playeridTextdraw103);
    return 
1;
    }
    return 
0;




Re: Trying to create a faction for a command. - darkhunter332 - 23.08.2017

What does it say in the error list?


Re: Trying to create a faction for a command. - Thanks - 23.08.2017

they didn't give me error but when i press /cmds given me Unkown Command. & i have include zcmd.


Re: Trying to create a faction for a command. - Thanks - 23.08.2017

any help


Re: Trying to create a faction for a command. - thegamer355 - 23.08.2017

You have a return 0; at the bottom of your code. Simply remove it. And move the return 1; to the end, so were the return 0; was.

Edited code below:

pawn Код:
CMD:cmds(playerid, params[])
{
    if(faction1[playerid] == 1)
    {
    TextDrawShowForPlayer(playerid, Textdraw66);
    TextDrawShowForPlayer(playerid, Textdraw67);
    TextDrawShowForPlayer(playerid, Textdraw68);
    TextDrawShowForPlayer(playerid, Textdraw69);
    TextDrawShowForPlayer(playerid, Textdraw70);
    TextDrawShowForPlayer(playerid, Textdraw71);
    TextDrawShowForPlayer(playerid, Textdraw72);
    TextDrawShowForPlayer(playerid, Textdraw73);
    TextDrawShowForPlayer(playerid, Textdraw74);
    TextDrawShowForPlayer(playerid, Textdraw75);
    TextDrawShowForPlayer(playerid, Textdraw76);
    TextDrawShowForPlayer(playerid, Textdraw77);
    TextDrawShowForPlayer(playerid, Textdraw78);
    TextDrawShowForPlayer(playerid, Textdraw79);
    TextDrawShowForPlayer(playerid, Textdraw80);
    TextDrawShowForPlayer(playerid, Textdraw81);
    TextDrawShowForPlayer(playerid, Textdraw82);
    TextDrawShowForPlayer(playerid, Textdraw83);
    TextDrawShowForPlayer(playerid, Textdraw84);
    TextDrawShowForPlayer(playerid, Textdraw85);
    TextDrawShowForPlayer(playerid, Textdraw86);
    TextDrawShowForPlayer(playerid, Textdraw87);
    TextDrawShowForPlayer(playerid, Textdraw88);
    TextDrawShowForPlayer(playerid, Textdraw89);
    TextDrawShowForPlayer(playerid, Textdraw90);
    TextDrawShowForPlayer(playerid, Textdraw91);
    TextDrawShowForPlayer(playerid, Textdraw92);
    TextDrawShowForPlayer(playerid, Textdraw93);
    TextDrawShowForPlayer(playerid, Textdraw94);
    TextDrawShowForPlayer(playerid, Textdraw95);
    TextDrawShowForPlayer(playerid, Textdraw96);
    TextDrawShowForPlayer(playerid, Textdraw97);
    TextDrawShowForPlayer(playerid, Textdraw98);
    TextDrawShowForPlayer(playerid, Textdraw99);
    TextDrawShowForPlayer(playerid, Textdraw100);
    TextDrawShowForPlayer(playerid, Textdraw101);
    TextDrawShowForPlayer(playerid, Textdraw102);
    TextDrawShowForPlayer(playerid, Textdraw103);
    }
    return 1;
}



Re: Trying to create a faction for a command. - Thanks - 23.08.2017

EDIT: Im trying to make like this

PHP код:
CMD:cmds(playeridparams[])
{
    if (
faction1[playerid] == 1)
    
TextDrawShowForPlayer(playeridTextdraw66);
    
TextDrawShowForPlayer(playeridTextdraw67);
    
TextDrawShowForPlayer(playeridTextdraw68);
    
TextDrawShowForPlayer(playeridTextdraw69);
    
TextDrawShowForPlayer(playeridTextdraw70);
    
TextDrawShowForPlayer(playeridTextdraw71);
    
TextDrawShowForPlayer(playeridTextdraw72);
    
TextDrawShowForPlayer(playeridTextdraw73);
    
TextDrawShowForPlayer(playeridTextdraw74);
    
TextDrawShowForPlayer(playeridTextdraw75);
    
TextDrawShowForPlayer(playeridTextdraw76);
    
TextDrawShowForPlayer(playeridTextdraw77);
    
TextDrawShowForPlayer(playeridTextdraw78);
    
TextDrawShowForPlayer(playeridTextdraw79);
    
TextDrawShowForPlayer(playeridTextdraw80);
    
TextDrawShowForPlayer(playeridTextdraw81);
    
TextDrawShowForPlayer(playeridTextdraw82);
    
TextDrawShowForPlayer(playeridTextdraw83);
    
TextDrawShowForPlayer(playeridTextdraw84);
    
TextDrawShowForPlayer(playeridTextdraw85);
    
TextDrawShowForPlayer(playeridTextdraw86);
    
TextDrawShowForPlayer(playeridTextdraw87);
    
TextDrawShowForPlayer(playeridTextdraw88);
    
TextDrawShowForPlayer(playeridTextdraw89);
    
TextDrawShowForPlayer(playeridTextdraw90);
    
TextDrawShowForPlayer(playeridTextdraw91);
    
TextDrawShowForPlayer(playeridTextdraw92);
    
TextDrawShowForPlayer(playeridTextdraw93);
    
TextDrawShowForPlayer(playeridTextdraw94);
    
TextDrawShowForPlayer(playeridTextdraw95);
    
TextDrawShowForPlayer(playeridTextdraw96);
    
TextDrawShowForPlayer(playeridTextdraw97);
    
TextDrawShowForPlayer(playeridTextdraw98);
    
TextDrawShowForPlayer(playeridTextdraw99);
    
TextDrawShowForPlayer(playeridTextdraw100);
    
TextDrawShowForPlayer(playeridTextdraw101);
    
TextDrawShowForPlayer(playeridTextdraw102);
    
TextDrawShowForPlayer(playeridTextdraw103);
    
TextDrawShowForPlayer(playeridTextdraw104);
    
TextDrawShowForPlayer(playeridTextdraw105);
    
TextDrawShowForPlayer(playeridTextdraw106);
    return 
1;

But when i press 1 giving me nothing.

PHP код:
if(InMenu[playerid] == 1)
        {
            if(
faction1[playerid]==1)
            {
               if(
strval(text)==1)
               {
                  
SendClientMessage(playerid, -1"{00FFFF}Coming Soon");
                  
InMenu[playerid]=1;
                  return 
0;
               } 



Re: Trying to create a faction for a command. - Bingo - 23.08.2017

Why are you using return 0?


Re: Trying to create a faction for a command. - thegamer355 - 23.08.2017

Quote:
Originally Posted by Thanks
Посмотреть сообщение
EDIT: Im trying to make like this

But when i press 1 giving me nothing.

PHP код:
if(InMenu[playerid] == 1)
        {
            if(
faction1[playerid]==1)
            {
               if(
strval(text)==1)
               {
                  
SendClientMessage(playerid, -1"{00FFFF}Coming Soon");
                  
InMenu[playerid]=1;
                  return 
0;
               } 
So, you're making that work if InMenu[playerid] == 1)
but in the code itself you're setting it to 1? what's the point of that?
Shouldn't the if(InMenu[playerid] == 1) be if(InMenu[playerid] == 0)?

About the return 0, just use return 1;

Also in the code above, please re-read what i've posted before, you are forgetting some {} this time


Re: Trying to create a faction for a command. - Thanks - 23.08.2017

Im using it like that

Код:
	if(InMenu[playerid] == 0)
		{
			if(faction1[playerid]==1)
			{
			   if(strval(text)==1)
			   {
				  SendClientMessage(playerid, -1, "{00FFFF}Coming Soon");
				  InMenu[playerid]=0;
				  return 1;
			   }
			}
			faction1[playerid]=1;
		}
   }
	  return 1;
}
And still not work!


Re: Trying to create a faction for a command. - Thanks - 23.08.2017

Im using it like that

Код:
	if(InMenu[playerid] == 0)
		{
			if(faction1[playerid]==1)
			{
			   if(strval(text)==1)
			   {
				  SendClientMessage(playerid, -1, "{00FFFF}Coming Soon");
				  InMenu[playerid]=0;
				  return 1;
			   }
			}
			faction1[playerid]=1;
		}
   }
	  return 1;
}
And still not work!