SA-MP Forums Archive
[HELP]Whats wrong In here? - 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: [HELP]Whats wrong In here? (/showthread.php?tid=165088)



[HELP]Whats wrong In here? - OldDirtyBastard - 03.08.2010

Ok so im making very basic fight style.
As i went to test it out, the /fightstyles cmd works, but when i tipe the cmd /fightstyle 1 or 2,
it just throws me the massages if the /fightstyles cmd,
It doesnt throws me any kinds of errors but it doesnt works eighter.
If anyone could look at this please:

pawn Код:
//=============================Fighting Style Help==============================
    if (strcmp("/fightstyles", cmdtext, true, 5) ==0)
    {
        SendClientMessage(playerid,COLOR_YELLOW,"You can select your fight styles with the command /fightstyle <1-6>");
        SendClientMessage(playerid,COLOR_YELLOW,"Availible Fight Styles:");
        SendClientMessage(playerid,COLOR_YELLOW,"Boxing-1, Kung-Fu-2, Street Fingting-3, Grab-Kick-4, Elbow-4, Normal-5");
        return 1;
    }
//=============================Fighting Styles==================================
    //Boxing
    if (strcmp("/fightstyle 1", cmdtext, true, 5) ==0)
    {
        SetPlayerFightingStyle(playerid, 5);
        SendClientMessage(playerid,COLOR_YELLOW,"You have selected the Boxing Fight Style!");
        return 1;
    }
    //Kung-Fu
    if (strcmp("/fightstyle 2", cmdtext, true, 5) ==0)
    {
        SetPlayerFightingStyle(playerid, 6);
        SendClientMessage(playerid,COLOR_YELLOW,"You have selected the Kung-Fu Fight Style!");
        return 1;
    }



Re: [HELP]Whats wrong In here? - Hiddos - 03.08.2010

Because /fightstyle hasn't got a size of 5 characters, remove it.

Just use:

if(!strcmp("/<command", cmdtext, 1))

Instead of

if(strcmp("/command", cmdtext, true, <sizeof /command>) == 0)


Re: [HELP]Whats wrong In here? - Koruda - 03.08.2010

edit:
...


Re: [HELP]Whats wrong In here? - Ash. - 03.08.2010

You have to use strtok and cases for /fightstyle _number_ - because there is a space, or just use this instead:

pawn Код:
//=============================Fighting Style Help==============================
    if (strcmp("/fightstyles", cmdtext, true, 5) ==0)
    {
        SendClientMessage(playerid,COLOR_YELLOW,"You can select your fight styles with the command /fightstyle <1-6>");
        SendClientMessage(playerid,COLOR_YELLOW,"Availible Fight Styles:");
        SendClientMessage(playerid,COLOR_YELLOW,"Boxing-1, Kung-Fu-2, Street Fingting-3, Grab-Kick-4, Elbow-4, Normal-5");
        return 1;
    }
//=============================Fighting Styles==================================
    //Boxing
    if (strcmp("/fightstyle1", cmdtext, true, 5) ==0)
    {
        SetPlayerFightingStyle(playerid, 5);
        SendClientMessage(playerid,COLOR_YELLOW,"You have selected the Boxing Fight Style!");
        return 1;
    }
    //Kung-Fu
    if (strcmp("/fightstyle2", cmdtext, true, 5) ==0)
    {
        SetPlayerFightingStyle(playerid, 6);
        SendClientMessage(playerid,COLOR_YELLOW,"You have selected the Kung-Fu Fight Style!");
        return 1;
    }
Use: /fightstyle1 and /fightstyle2 instead


Re: [HELP]Whats wrong In here? - Hiddos - 03.08.2010

@funky: That obviously won't work, since /fightstyles is checked before the other /fightstyle cmds.


Re: [HELP]Whats wrong In here? - OldDirtyBastard - 03.08.2010

i shoud serach on wiki first and then desperatly ask here lol, it shoud be like this
pawn Код:
if (strcmp(cmdtext, "/boxing", true) == 0)
{
    SetPlayerFightingStyle (playerid, FIGHT_STYLE_BOXING);
    SendClientMessage(playerid, 0xFFFFFFAA, "You have changed your fighting style to boxing!");
    return 1;
}
Thakns anyway.