SA-MP Forums Archive
Just a little help with ZCMD - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Just a little help with ZCMD (/showthread.php?tid=116209)



Just a little help with ZCMD - pagie1111 - 27.12.2009

I tried making a command "/fightstyle [STYLE]"

here is what I attempted, got 3 errors:

pawn Код:
COMMAND:fightstyle(playerid, params[])
    {
      if(IsPlayerConnected(playerid))
      {
        new option;
        if(!sscanf(params, "i", option))
        {
                if(strcmp(option, "normal", true) == 0)
                {
                if(GetPlayerFightingStyle(playerid) == FIGHT_STYLE_NORMAL) return SendClientMessage(playerid,CORAL,"Your fighting style is already normal");
                    else SetPlayerFightingStyle(playerid, FIGHT_STYLE_NORMAL), SendClientMessage(playerid,LIME,"Fighting style set");
                }
                if(strcmp(option, "boxing", true) == 0)
                {
                if(GetPlayerFightingStyle(playerid) == FIGHT_STYLE_BOXING) return SendClientMessage(playerid,CORAL,"Your fighting style is already boxing");
                    else SetPlayerFightingStyle(playerid, FIGHT_STYLE_BOXING), SendClientMessage(playerid,LIME,"Fighting style set");
                }
                if(strcmp(option, "kungfu", true) == 0)
                {
                    if(GetPlayerFightingStyle(playerid) == FIGHT_STYLE_KUNGFU) return SendClientMessage(playerid,CORAL,"Your fighting style is already kungfu");
                    else SetPlayerFightingStyle(playerid, FIGHT_STYLE_KUNGFU), SendClientMessage(playerid,LIME,"Fighting style set");
                }
                else return SendClientMessage(playerid,CORAL,"Invalid Style");
            }
            else
            {
              SendClientMessage(playerid,CORAL,"USAGE: /fightstyle [STYLE]");
              SendClientMessage(playerid,CORAL,"STYLES: normal boxing kungfu");
              return 1;
            }
        }
        else return 0;
        return 1;
    }
Thank you.


Re: Just a little help with ZCMD - Correlli - 27.12.2009

Quote:
Originally Posted by Awaran[Enemy-Plus
; ]
got 3 errors
Post them.


Re: Just a little help with ZCMD - pagie1111 - 27.12.2009

Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by Awaran[Enemy-Plus
; ]
got 3 errors
Post them.
Whoa, dickhead moment for me. I forgot them :P

Код:
F:\SAMP 0.3\testzcmd.pwn(215) : error 035: argument type mismatch (argument 1)
F:\SAMP 0.3\testzcmd.pwn(220) : error 035: argument type mismatch (argument 1)
F:\SAMP 0.3\testzcmd.pwn(225) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
All errors are on the lines where strcmp are


Re: Just a little help with ZCMD - Correlli - 27.12.2009

option is an integer, it should be an array.


Re: Just a little help with ZCMD - pagie1111 - 27.12.2009

Quote:
Originally Posted by Don Correlli
option is an integer, it should be an array.
Thanks... You're good ^^ lol


Re: Just a little help with ZCMD - pagie1111 - 28.12.2009


pawn Код:
COMMAND:fightstyle(playerid, params[])
{
  if(IsPlayerConnected(playerid))
  {
    new option[10];
    sscanf(params, "s", option);
    {
            if(isnull(option))
            {
            SendClientMessage(playerid,CORAL,"USAGE: /fightstyle [STYLE]");
            SendClientMessage(playerid,CORAL,"STYLES: normal boxing kungfu");
                return 1;
            }
            if(strcmp(option, "normal", true) == 0)
            {
            if(GetPlayerFightingStyle(playerid) == FIGHT_STYLE_NORMAL) return SendClientMessage(playerid,CORAL,"Your fighting style is already normal");
                else SetPlayerFightingStyle(playerid, FIGHT_STYLE_NORMAL), SendClientMessage(playerid,LIME,"Fighting style set");
            }
            if(strcmp(option, "boxing", true) == 0)
            {
                if(GetPlayerFightingStyle(playerid) == FIGHT_STYLE_BOXING) return SendClientMessage(playerid,CORAL,"Your fighting style is already boxing");
                else SetPlayerFightingStyle(playerid, FIGHT_STYLE_BOXING), SendClientMessage(playerid,LIME,"Fighting style set");
            }
            if(strcmp(option, "kungfu", true) == 0)
            {
                if(GetPlayerFightingStyle(playerid) == FIGHT_STYLE_KUNGFU) return SendClientMessage(playerid,CORAL,"Your fighting style is already kungfu");
                else SetPlayerFightingStyle(playerid, FIGHT_STYLE_KUNGFU), SendClientMessage(playerid,LIME,"Fighting style set");
            }
            else return SendClientMessage(playerid,CORAL,"Invalid Style");
        }
    }
    else return 0;
    return 1;
}
now this isnt working...


Re: Just a little help with ZCMD - Sergei - 28.12.2009

How is player supposed to use command if he/she isn't connected? Why do you use IsPlayerConnected then ...

pawn Код:
COMMAND:fightstyle(playerid, params[])
{
    new option[10];
    if(!sscanf(params, "s", option);
    {
        if(strcmp(option, "normal", true) == 0)
        {
            if(GetPlayerFightingStyle(playerid) == FIGHT_STYLE_NORMAL) SendClientMessage(playerid,CORAL,"Your fighting style is already normal");
            else SetPlayerFightingStyle(playerid, FIGHT_STYLE_NORMAL), SendClientMessage(playerid,LIME,"Fighting style set");
        }
        else if(strcmp(option, "boxing", true) == 0)
        {
            if(GetPlayerFightingStyle(playerid) == FIGHT_STYLE_BOXING) SendClientMessage(playerid,CORAL,"Your fighting style is already boxing");
            else SetPlayerFightingStyle(playerid, FIGHT_STYLE_BOXING), SendClientMessage(playerid,LIME,"Fighting style set");
        }
        else if(strcmp(option, "kungfu", true) == 0)
        {
            if(GetPlayerFightingStyle(playerid) == FIGHT_STYLE_KUNGFU) SendClientMessage(playerid,CORAL,"Your fighting style is already kungfu");
            else SetPlayerFightingStyle(playerid, FIGHT_STYLE_KUNGFU), SendClientMessage(playerid,LIME,"Fighting style set");
        }
        else SendClientMessage(playerid,CORAL,"Invalid Style");
    }
    else
    {
        SendClientMessage(playerid,CORAL,"USAGE: /fightstyle [STYLE]");
        SendClientMessage(playerid,CORAL,"STYLES: normal boxing kungfu");
    }
    return 1;
}



Re: Just a little help with ZCMD - dice7 - 28.12.2009

Why do you use sscanf ?
Just compare params in strcmp