[HELP] Fight Styles command
#1

Код:
#include <a_samp>

    #if defined FILTERSCRIPT

    public OnFilterScriptInit()
    {
            print("\n--------------------------------------");
            print(" Made By Meow22");
            print("--------------------------------------\n");
            return 1;
    }

    public OnFilterScriptExit()
    {
            return 1;
    }

    if (strcmp("/fstyles", cmdtext, true, 11) == 0)
            {
                    ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Fighting Style's", "Normal\nBoxing\nKungfu\nKneeHead\nGrabKick\nElbow", "Change", "Cancel");
                    return 1;
            }


    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    if(response)
        {
        switch(dialogid)

                    case 3:
                {
                    switch(listitem)
                    {
                        case 0:
                        {
                            SetPlayerFightingStyle (playerid, FIGHT_STYLE_NORMAL);
                                    SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the Normal fight style! -|");
                        }
                        case 1:
                        {
                            SetPlayerFightingStyle (playerid, FIGHT_STYLE_BOXING);
                                            SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the Boxing fight style! -|");
                        }
                        case 2:
                        {
                            SetPlayerFightingStyle (playerid, FIGHT_STYLE_KUNGFU);
                                    SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the Kungfu fight style! -|");
                        }
                        case 3:
                        {
                            SetPlayerFightingStyle (playerid, FIGHT_STYLE_KNEEHEAD);
                                    SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the KneeHead fight style! -|");
                            }
                            case 4:
                            {
                                            SetPlayerFightingStyle (playerid, FIGHT_STYLE_GRABKICK);
                                    SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the GrabKick fight style! -|");
                                    }
                                    case 5:
                                    {
                                            SetPlayerFightingStyle (playerid, FIGHT_STYLE_ELBOW);
                                    SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the Elbow fight style! -|");
                                    }
                            }
                            }
                    }
            }

                            return 1;
    }

    #endif
When I type /fstyles , nothings changed
Reply
#2

PHP код:
#define FILTERSCRIPT

#if defined FILTERSCRIPT

#include <a_samp>

public OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/fstyles"cmdtexttrue10) == 0)
    {
        
ShowPlayerDialog(playerid3DIALOG_STYLE_LIST"Fighting Style's""Normal\nBoxing\nKungfu\nKneeHead\nGrabKick\nElbow""Change""Cancel");
        return 
true;
    }
    return 
false;
}

public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
3:
        {
            if(
response == 1)
            {
                switch(
listitem)
                {
                    case 
0:
                    {
                        
SetPlayerFightingStyle (playeridFIGHT_STYLE_NORMAL);
                        
SendClientMessage(playerid0x00FF00"|- You have changed your fighting style to the Normal fight style! -|");
                    }
                    case 
1:
                    {
                        
SetPlayerFightingStyle (playeridFIGHT_STYLE_BOXING);
                        
SendClientMessage(playerid0x00FF00"|- You have changed your fighting style to the Boxing fight style! -|");
                    }
                    case 
2:
                    {
                        
SetPlayerFightingStyle (playeridFIGHT_STYLE_KUNGFU);
                        
SendClientMessage(playerid0x00FF00"|- You have changed your fighting style to the Kungfu fight style! -|");
                    }
                    case 
3:
                    {
                        
SetPlayerFightingStyle (playeridFIGHT_STYLE_KNEEHEAD);
                        
SendClientMessage(playerid0x00FF00"|- You have changed your fighting style to the KneeHead fight style! -|");
                    }
                    case 
4:
                    {
                        
SetPlayerFightingStyle (playeridFIGHT_STYLE_GRABKICK);
                        
SendClientMessage(playerid0x00FF00"|- You have changed your fighting style to the GrabKick fight style! -|");
                    }
                    case 
5:
                    {
                        
SetPlayerFightingStyle (playeridFIGHT_STYLE_ELBOW);
                        
SendClientMessage(playerid0x00FF00"|- You have changed your fighting style to the Elbow fight style! -|");
                    }
                }
            }
        }
    }
    return 
true;
}

#endif 
first dialogid affter response last listitem and command in OnPlayerCommandText.
Reply
#3

nothings changed :l
Reply
#4

try changing dialogid?, you might be using these dialogs somewhere else?
Reply
#5

Try this
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/fstyles", cmdtext, true, 11) == 0)
            {
                    SendClientMessage(playerid, -1,"___________|FIGHT STYLES|__________");
                    SendClientMessage(playerid, -1,"/f2 - Boxing");
                    SendClientMessage(playerid, -1,"/f3 - Kungfu");
                    SendClientMessage(playerid, -1,"/f4 - KneeHead");
                    SendClientMessage(playerid, -1,"/f5 - Grabkick");
                    SendClientMessage(playerid, -1,"/f6 - Elbow");
                    return 1;
            }
//--------------------COMMAND FOR FIGHTING STYLES
            if (strcmp("/f1", cmdtext, true, 11) == 0)
            {
                      SetPlayerFightingStyle (playerid, FIGHT_STYLE_NORMAL);
                        SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the Normal fight style! -|");
                    return 1;
             }
            if (strcmp("/f2", cmdtext, true, 11) == 0)
            {
                        SetPlayerFightingStyle (playerid, FIGHT_STYLE_BOXING);
                        SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the Boxing fight style! -|");
                    return 1;
            }
             if (strcmp("/f3", cmdtext, true, 11) == 0)
            {
                       SetPlayerFightingStyle (playerid, FIGHT_STYLE_KUNGFU);
                        SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the Kungfu fight style! -|");
                    return 1;
            }
             if (strcmp("/f4", cmdtext, true, 11) == 0)
            {
                       SetPlayerFightingStyle (playerid, FIGHT_STYLE_KNEEHEAD);
                       SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the KneeHead fight style! -|");
                    return 1;
            }
            if (strcmp("/f5", cmdtext, true, 11) == 0)
            {
                      SetPlayerFightingStyle (playerid, FIGHT_STYLE_GRABKICK);
                      SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the GrabKick fight style! -|");
                    return 1;
            }
            if (strcmp("/f6", cmdtext, true, 11) == 0)
            {
                       SetPlayerFightingStyle (playerid, FIGHT_STYLE_ELBOW);
                        SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the Elbow fight style! -|");
                    return 1;
            }
           return 0;
}
Reply
#6

Quote:
Originally Posted by karan007
Посмотреть сообщение
Try this
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/fstyles", cmdtext, true, 11) == 0)
            {
                    SendClientMessage(playerid, -1,"___________|FIGHT STYLES|__________");
                    SendClientMessage(playerid, -1,"/f2 - Boxing");
                    SendClientMessage(playerid, -1,"/f3 - Kungfu");
                    SendClientMessage(playerid, -1,"/f4 - KneeHead");
                    SendClientMessage(playerid, -1,"/f5 - Grabkick");
                    SendClientMessage(playerid, -1,"/f6 - Elbow");
                    return 1;
            }
//--------------------COMMAND FOR FIGHTING STYLES
            if (strcmp("/f1", cmdtext, true, 11) == 0)
            {
                      SetPlayerFightingStyle (playerid, FIGHT_STYLE_NORMAL);
                        SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the Normal fight style! -|");
                    return 1;
             }
            if (strcmp("/f2", cmdtext, true, 11) == 0)
            {
                        SetPlayerFightingStyle (playerid, FIGHT_STYLE_BOXING);
                        SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the Boxing fight style! -|");
                    return 1;
            }
             if (strcmp("/f3", cmdtext, true, 11) == 0)
            {
                       SetPlayerFightingStyle (playerid, FIGHT_STYLE_KUNGFU);
                        SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the Kungfu fight style! -|");
                    return 1;
            }
             if (strcmp("/f4", cmdtext, true, 11) == 0)
            {
                       SetPlayerFightingStyle (playerid, FIGHT_STYLE_KNEEHEAD);
                       SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the KneeHead fight style! -|");
                    return 1;
            }
            if (strcmp("/f5", cmdtext, true, 11) == 0)
            {
                      SetPlayerFightingStyle (playerid, FIGHT_STYLE_GRABKICK);
                      SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the GrabKick fight style! -|");
                    return 1;
            }
            if (strcmp("/f6", cmdtext, true, 11) == 0)
            {
                       SetPlayerFightingStyle (playerid, FIGHT_STYLE_ELBOW);
                        SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the Elbow fight style! -|");
                    return 1;
            }
           return 0;
}
I got many loose indentation
Reply
#7

Quote:
Originally Posted by XYZero
Посмотреть сообщение
I got many loose indentation
Reason because of this loose indentation error :- This is because its not having spaces.

SOLUTIONS


Add this under #define <a_samp> in your gamemode.

Код:
#pragma tabsize 0
Reply
#8

so fix indentations

example code without correct indentation:

pawn Код:
if (strcmp("/f2", cmdtext, true, 11) == 0)
            {
          SetPlayerFightingStyle (playerid, FIGHT_STYLE_BOXING);
                        SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the Boxing fight style! -|");
                    return 1;
            }
and correct indentation:

pawn Код:
if (strcmp("/f2", cmdtext, true, 11) == 0)
{
    SetPlayerFightingStyle (playerid, FIGHT_STYLE_BOXING);
    SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the Boxing fight style! -|");
    return 1;
}

@karan007: that's worst advise.
Reply
#9

or try this :/ :3

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/fstyles", cmdtext, true, 11) == 0)
    {
        SendClientMessage(playerid, -1,"___________|FIGHT STYLES|__________");
        SendClientMessage(playerid, -1,"/f2 - Boxing");
        SendClientMessage(playerid, -1,"/f3 - Kungfu");
        SendClientMessage(playerid, -1,"/f4 - KneeHead");
        SendClientMessage(playerid, -1,"/f5 - Grabkick");
        SendClientMessage(playerid, -1,"/f6 - Elbow");
        return 1;
    }
    if (strcmp("/f1", cmdtext, true, 11) == 0)
    {
        SetPlayerFightingStyle (playerid, FIGHT_STYLE_NORMAL);
        SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the Normal fight style! -|");
        return 1;
    }
    if (strcmp("/f2", cmdtext, true, 11) == 0)
    {
        SetPlayerFightingStyle (playerid, FIGHT_STYLE_BOXING);
        SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the Boxing fight style! -|");
        return 1;
    }
    if (strcmp("/f3", cmdtext, true, 11) == 0)
    {
        SetPlayerFightingStyle (playerid, FIGHT_STYLE_KUNGFU);
        SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the Kungfu fight style! -|");
        return 1;
    }
    if (strcmp("/f4", cmdtext, true, 11) == 0)
    {
        SetPlayerFightingStyle (playerid, FIGHT_STYLE_KNEEHEAD);
        SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the KneeHead fight style! -|");
        return 1;
    }
    if (strcmp("/f5", cmdtext, true, 11) == 0)
    {
        SetPlayerFightingStyle (playerid, FIGHT_STYLE_GRABKICK);
        SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the GrabKick fight style! -|");
                    return 1;
    }
    if (strcmp("/f6", cmdtext, true, 11) == 0)
    {
        SetPlayerFightingStyle (playerid, FIGHT_STYLE_ELBOW);
        SendClientMessage(playerid, 0x00FF00, "|- You have changed your fighting style to the Elbow fight style! -|");
        return 1;
    }
    return 0;
}
Reply
#10

Quote:
Originally Posted by karan007
Посмотреть сообщение
Reason because of this loose indentation error :- This is because its not having spaces.

SOLUTIONS


Add this under #define <a_samp> in your gamemode.

Код:
#pragma tabsize 0
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)