SA-MP Forums Archive
server unknown 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: server unknown command (/showthread.php?tid=381315)



server unknown command - Anak - 29.09.2012

hello im facing a problem for example if i do /drink server says unknown command
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/drink", true)==0)
{
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "What is it that you want?", "Pepsi cola ($1)\nCoke ($2)\nBeer($3)", "Purchase", "Cancel");
    return 0;
}
help its just example i have many commands


Re: server unknown command - CaRa - 29.09.2012

Код:
 public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/drink", cmdtext, true, 10) == 0)
{
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "What is it that you want?", "Pepsi cola ($1)\nCoke ($2)\nBeer($3)", "Purchase", "Cancel");
    return 1;
}
return 0; block the command so i changed to return 1;


Re: server unknown command - .v - 29.09.2012

Yet

Код:
 public OnPlayerCommandText(playerid, cmdtext[])
{
   if(!strcmp(cmdtext, "/drink", true)==0)
   {
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "What is it that you want?", "Pepsi cola ($1)\nCoke ($2)\nBeer($3)", "Purchase", "Cancel");
    return 1;
   }
   return 0;
}



Re: server unknown command - CaRa - 29.09.2012

Did you explain why you do that ? May in the future be learned mind something ...


Re: server unknown command - Anak - 29.09.2012

Quote:
Originally Posted by CaRa
Посмотреть сообщение
Код:
 public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/drink", cmdtext, true, 10) == 0)
{
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "What is it that you want?", "Pepsi cola ($1)\nCoke ($2)\nBeer($3)", "Purchase", "Cancel");
    return 1;
}
return 0; block the command so i changed to return 1;
not work


Re: server unknown command - CaRa - 29.09.2012

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
   if (strcmp("/drink", cmdtext, true, 10) == 0)
   {
         ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "What is it that you want?", "Pepsi cola ($1)\nCoke ($2)\nBeer($3)", "Purchase", "Cancel");
         return 1;
   }
   return 1;
}
Now it should work.


Re: server unknown command - Anak - 29.09.2012

still not working


Re: server unknown command - Anak - 29.09.2012

ok full FS
Код:
#include <a_samp>
#define filerscript
#if defined FILTERSCRIPT

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/drink", cmdtext, true, 10) == 0)
{
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "What is it that you want?", "Sprunk ($1)\nBeer ($2)\nWine ($3)", "Purchase", "Cancel");
    return 1;
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)
    {
    switch(1)
        {
		case 1:
    	    {
           	switch(listitem)
        	{
        	    case 0:
        	    {
        	        if(GetPlayerMoney(playerid) < 1) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
        	        GivePlayerMoney(playerid, -1);
        	        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_SPRUNK);
        	    }
        	    case 1: 
        	    {
        	        if(GetPlayerMoney(playerid) < 2) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
        	        GivePlayerMoney(playerid, -2);
        	        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_BEER);
        	    }
        	    case 2:
        	    {
        	        if(GetPlayerMoney(playerid) < 3) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
        	        GivePlayerMoney(playerid, -3);
        	        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_WINE);
  
 return 1;
}
#endif



Re: server unknown command - RedJohn - 29.09.2012

pawn Код:
#include <a_samp>
#define filerscript
#if defined FILTERSCRIPT
forward OnPlayerCommandPerformed(playerid, cmdtext[], success);

public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success) return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/drink", cmdtext, true, 10) == 0)
    {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "What is it that you want?", "Sprunk ($1)\nBeer ($2)\nWine ($3)", "Purchase", "Cancel");
        return 1;
    }
    return 1;
}



Re: server unknown command - Gangster-rocks - 29.09.2012

pawn Код:
if (!strcmp("/drink", cmdtext, true, 10))
{
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "What is it that you want?", "Sprunk ($1)\nBeer ($2)\nWine ($3)", "Purchase", "Cancel");
    return 1;
}