[HELP]Whats wrong In here?
#1

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;
    }
Reply
#2

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)
Reply
#3

edit:
...
Reply
#4

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
Reply
#5

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

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)