Need help with OnPlayerKeyStateChange
#1

Error:
Код:
C:\Users\Hellman\Desktop\Rebound Roleplay server\pawno\include\/CRP/Publics/OnPlayerKeyStateChange.pwn(58) : warning 217: loose indentation
C:\Users\Hellman\Desktop\Rebound Roleplay server\pawno\include\/CRP/Publics/OnPlayerKeyStateChange.pwn(133) : error 029: invalid expression, assumed zero
C:\Users\Hellman\Desktop\Rebound Roleplay server\pawno\include\/CRP/Publics/OnPlayerKeyStateChange.pwn(133) : warning 215: expression has no effect
C:\Users\Hellman\Desktop\Rebound Roleplay server\pawno\include\/CRP/Publics/OnPlayerKeyStateChange.pwn(133) : error 001: expected token: ";", but found "if"







pawn Код:
}
    new udlr, ud, lr;
    GetPlayerKeys(playerid, udlr, ud, lr);
    if(HOLDING(KEY_WALK) && ud > 0 || HOLDING(KEY_WALK) && ud < 0 || HOLDING(KEY_WALK) && lr > 0 || HOLDING(KEY_WALK) && lr < 0) {
       if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT)
    {
        return 1;
    }

    switch(PlayerInfo[playerid][pWalk]) line 58
    {
        case 1:
        {
            LoopingAnim(playerid,"PED","WALK_gang1",4.1,1,1,1,1,1);
        }
        case 2:
        {
            LoopingAnim(playerid,"PED","WOMAN_walksexy",4.1,1,1,1,1,1);
        }
        case 3:
        {
            LoopingAnim(playerid,"PED","WALK_armed",4.1,1,1,1,1,1);
        }
        case 4:
        {
            LoopingAnim(playerid,"PED","WALK_civi",4.1,1,1,1,1,1);
        }
        case 5:
        {
            LoopingAnim(playerid,"PED","WALK_csaw",4.1,1,1,1,1,1);
        }
        case 6:
        {
            LoopingAnim(playerid,"PED","WALK_gang2",4.1,1,1,1,1,1);
        }
        case 7:
        {
            LoopingAnim(playerid,"PED","WALK_drunk",4.1,1,1,1,1,1);
        }
        case 8:
        {
            LoopingAnim(playerid,"PED","WALK_fat",4.1,1,1,1,1,1);
        }
        case 9:
        {
            LoopingAnim(playerid,"PED","WALK_fatold",4.1,1,1,1,1,1);
        }
        case 10:
        {
            LoopingAnim(playerid,"PED","WALK_old",4.1,1,1,1,1,1);
        }
        case 11:
        {
            LoopingAnim(playerid,"PED","WALK_player",4.1,1,1,1,1,1);
        }
        case 12:
        {
            LoopingAnim(playerid,"PED","WALK_rocket",4.1,1,1,1,1,1);
        }
        case 13:
        {
            LoopingAnim(playerid,"PED","WALK_shuffle",4.1,1,1,1,1,1);
        }
        case 14:
        {
            LoopingAnim(playerid,"PED","WOMAN_walknorm",4.1,1,1,1,1,1);
        }
        case 15:
        {
            LoopingAnim(playerid,"PED","WOMAN_walkpro",4.1,1,1,1,1,1);
        }
        case 16:
        {
            LoopingAnim(playerid,"PED","WOMAN_walkbusy",4.1,1,1,1,1,1);
        }
        case 17:
        {
            LoopingAnim(playerid,"PED","WOMAN_walknorm",4.1,1,1,1,1,1);
        }
        case 18:
        {
            LoopingAnim(playerid,"PED","Walk_Wuzi",4.1,1,1,1,1,1);
        }
       
    } else if(RELEASED(KEY_WALK)) { Line 133
        // Once a player releases ALT.
    }
    return 1;
    }
Reply
#2

Try with this:
pawn Код:
}
    new udlr, ud, lr;
    GetPlayerKeys(playerid, udlr, ud, lr);
    if(HOLDING(KEY_WALK) && ud > 0 || HOLDING(KEY_WALK) && ud < 0 || HOLDING(KEY_WALK) && lr > 0 || HOLDING(KEY_WALK) && lr < 0) {
       if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT)
    {
        return 1;
    }

    switch(PlayerInfo[playerid][pWalk]) line 58
    {
        case 1:
        {
            LoopingAnim(playerid,"PED","WALK_gang1",4.1,1,1,1,1,1);
        }
        case 2:
        {
            LoopingAnim(playerid,"PED","WOMAN_walksexy",4.1,1,1,1,1,1);
        }
        case 3:
        {
            LoopingAnim(playerid,"PED","WALK_armed",4.1,1,1,1,1,1);
        }
        case 4:
        {
            LoopingAnim(playerid,"PED","WALK_civi",4.1,1,1,1,1,1);
        }
        case 5:
        {
            LoopingAnim(playerid,"PED","WALK_csaw",4.1,1,1,1,1,1);
        }
        case 6:
        {
            LoopingAnim(playerid,"PED","WALK_gang2",4.1,1,1,1,1,1);
        }
        case 7:
        {
            LoopingAnim(playerid,"PED","WALK_drunk",4.1,1,1,1,1,1);
        }
        case 8:
        {
            LoopingAnim(playerid,"PED","WALK_fat",4.1,1,1,1,1,1);
        }
        case 9:
        {
            LoopingAnim(playerid,"PED","WALK_fatold",4.1,1,1,1,1,1);
        }
        case 10:
        {
            LoopingAnim(playerid,"PED","WALK_old",4.1,1,1,1,1,1);
        }
        case 11:
        {
            LoopingAnim(playerid,"PED","WALK_player",4.1,1,1,1,1,1);
        }
        case 12:
        {
            LoopingAnim(playerid,"PED","WALK_rocket",4.1,1,1,1,1,1);
        }
        case 13:
        {
            LoopingAnim(playerid,"PED","WALK_shuffle",4.1,1,1,1,1,1);
        }
        case 14:
        {
            LoopingAnim(playerid,"PED","WOMAN_walknorm",4.1,1,1,1,1,1);
        }
        case 15:
        {
            LoopingAnim(playerid,"PED","WOMAN_walkpro",4.1,1,1,1,1,1);
        }
        case 16:
        {
            LoopingAnim(playerid,"PED","WOMAN_walkbusy",4.1,1,1,1,1,1);
        }
        case 17:
        {
            LoopingAnim(playerid,"PED","WOMAN_walknorm",4.1,1,1,1,1,1);
        }
        case 18:
        {
            LoopingAnim(playerid,"PED","Walk_Wuzi",4.1,1,1,1,1,1);
        }
    }
    } else if(RELEASED(KEY_WALK)) { Line 133
        // Once a player releases ALT.
    }
    return 1;
    }
Reply
#3

Still same.
Reply
#4

Let's try now:
pawn Код:
//Maybe another if here ?
{ //if not delete this bracket.
    new udlr, ud, lr;
    GetPlayerKeys(playerid, udlr, ud, lr);
    if(HOLDING(KEY_WALK) && ud > 0 || HOLDING(KEY_WALK) && ud < 0 || HOLDING(KEY_WALK) && lr > 0 || HOLDING(KEY_WALK) && lr < 0)
    {
        if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) { return 1; }
        switch(PlayerInfo[playerid][pWalk])
        {
            //Don't worry about this way, it works 100% without problems. ;)
            case 1: LoopingAnim(playerid,"PED","WALK_gang1",4.1,1,1,1,1,1);
            case 2: LoopingAnim(playerid,"PED","WOMAN_walksexy",4.1,1,1,1,1,1);
            case 3: LoopingAnim(playerid,"PED","WALK_armed",4.1,1,1,1,1,1);
            case 4: LoopingAnim(playerid,"PED","WALK_civi",4.1,1,1,1,1,1);
            case 5: LoopingAnim(playerid,"PED","WALK_csaw",4.1,1,1,1,1,1);
            case 6: LoopingAnim(playerid,"PED","WALK_gang2",4.1,1,1,1,1,1);
            case 7: LoopingAnim(playerid,"PED","WALK_drunk",4.1,1,1,1,1,1);
            case 8: LoopingAnim(playerid,"PED","WALK_fat",4.1,1,1,1,1,1);
            case 9: LoopingAnim(playerid,"PED","WALK_fatold",4.1,1,1,1,1,1);
            case 10: LoopingAnim(playerid,"PED","WALK_old",4.1,1,1,1,1,1);
            case 11: LoopingAnim(playerid,"PED","WALK_player",4.1,1,1,1,1,1);
            case 12: LoopingAnim(playerid,"PED","WALK_rocket",4.1,1,1,1,1,1);
            case 13: LoopingAnim(playerid,"PED","WALK_shuffle",4.1,1,1,1,1,1);
            case 14: LoopingAnim(playerid,"PED","WOMAN_walknorm",4.1,1,1,1,1,1);
            case 15: LoopingAnim(playerid,"PED","WOMAN_walkpro",4.1,1,1,1,1,1);
            case 16: LoopingAnim(playerid,"PED","WOMAN_walkbusy",4.1,1,1,1,1,1);
            case 17: LoopingAnim(playerid,"PED","WOMAN_walknorm",4.1,1,1,1,1,1);
            case 18: LoopingAnim(playerid,"PED","Walk_Wuzi",4.1,1,1,1,1,1);
        }
    }
    else if(RELEASED(KEY_WALK))
    {
        //Your code
    }
    return 1; //I don't know if this is the end of your callback, if it is don't delete it. If not, maybe yes. xD
}
Reply
#5

Quote:
Originally Posted by irinel1996
Посмотреть сообщение
Let's try now:
pawn Код:
//Maybe another if here ?
{ //if not delete this bracket.
    new udlr, ud, lr;
    GetPlayerKeys(playerid, udlr, ud, lr);
    if(HOLDING(KEY_WALK) && ud > 0 || HOLDING(KEY_WALK) && ud < 0 || HOLDING(KEY_WALK) && lr > 0 || HOLDING(KEY_WALK) && lr < 0)
    {
        if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) { return 1; }
        switch(PlayerInfo[playerid][pWalk])
        {
            //Don't worry about this way, it works 100% without problems. ;)
            case 1: LoopingAnim(playerid,"PED","WALK_gang1",4.1,1,1,1,1,1);
            case 2: LoopingAnim(playerid,"PED","WOMAN_walksexy",4.1,1,1,1,1,1);
            case 3: LoopingAnim(playerid,"PED","WALK_armed",4.1,1,1,1,1,1);
            case 4: LoopingAnim(playerid,"PED","WALK_civi",4.1,1,1,1,1,1);
            case 5: LoopingAnim(playerid,"PED","WALK_csaw",4.1,1,1,1,1,1);
            case 6: LoopingAnim(playerid,"PED","WALK_gang2",4.1,1,1,1,1,1);
            case 7: LoopingAnim(playerid,"PED","WALK_drunk",4.1,1,1,1,1,1);
            case 8: LoopingAnim(playerid,"PED","WALK_fat",4.1,1,1,1,1,1);
            case 9: LoopingAnim(playerid,"PED","WALK_fatold",4.1,1,1,1,1,1);
            case 10: LoopingAnim(playerid,"PED","WALK_old",4.1,1,1,1,1,1);
            case 11: LoopingAnim(playerid,"PED","WALK_player",4.1,1,1,1,1,1);
            case 12: LoopingAnim(playerid,"PED","WALK_rocket",4.1,1,1,1,1,1);
            case 13: LoopingAnim(playerid,"PED","WALK_shuffle",4.1,1,1,1,1,1);
            case 14: LoopingAnim(playerid,"PED","WOMAN_walknorm",4.1,1,1,1,1,1);
            case 15: LoopingAnim(playerid,"PED","WOMAN_walkpro",4.1,1,1,1,1,1);
            case 16: LoopingAnim(playerid,"PED","WOMAN_walkbusy",4.1,1,1,1,1,1);
            case 17: LoopingAnim(playerid,"PED","WOMAN_walknorm",4.1,1,1,1,1,1);
            case 18: LoopingAnim(playerid,"PED","Walk_Wuzi",4.1,1,1,1,1,1);
        }
    }
    else if(RELEASED(KEY_WALK))
    {
        //Your code
    }
    return 1; //I don't know if this is the end of your callback, if it is don't delete it. If not, maybe yes. xD
}
no no no , is that (sry for copying but i modification ) make that:


pawn Код:
//Maybe another if here ?
{ //if not delete this bracket.
    new udlr, ud, lr;
    GetPlayerKeys(playerid, udlr, ud, lr);
    if(HOLDING(KEY_WALK) && ud > 0 || HOLDING(KEY_WALK) && ud < 0 || HOLDING(KEY_WALK) && lr > 0 || HOLDING(KEY_WALK) && lr < 0)
    {
        if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) { return 1; }
        switch(PlayerInfo[playerid][pWalk])
        {
            //Don't worry about this way, it works 100% without problems. ;)
            case 1: LoopingAnim(playerid,"PED","WALK_gang1",4.1,1,1,1,1,1);
            case 2: LoopingAnim(playerid,"PED","WOMAN_walksexy",4.1,1,1,1,1,1);
            case 3: LoopingAnim(playerid,"PED","WALK_armed",4.1,1,1,1,1,1);
            case 4: LoopingAnim(playerid,"PED","WALK_civi",4.1,1,1,1,1,1);
            case 5: LoopingAnim(playerid,"PED","WALK_csaw",4.1,1,1,1,1,1);
            case 6: LoopingAnim(playerid,"PED","WALK_gang2",4.1,1,1,1,1,1);
            case 7: LoopingAnim(playerid,"PED","WALK_drunk",4.1,1,1,1,1,1);
            case 8: LoopingAnim(playerid,"PED","WALK_fat",4.1,1,1,1,1,1);
            case 9: LoopingAnim(playerid,"PED","WALK_fatold",4.1,1,1,1,1,1);
            case 10: LoopingAnim(playerid,"PED","WALK_old",4.1,1,1,1,1,1);
            case 11: LoopingAnim(playerid,"PED","WALK_player",4.1,1,1,1,1,1);
            case 12: LoopingAnim(playerid,"PED","WALK_rocket",4.1,1,1,1,1,1);
            case 13: LoopingAnim(playerid,"PED","WALK_shuffle",4.1,1,1,1,1,1);
            case 14: LoopingAnim(playerid,"PED","WOMAN_walknorm",4.1,1,1,1,1,1);
            case 15: LoopingAnim(playerid,"PED","WOMAN_walkpro",4.1,1,1,1,1,1);
            case 16: LoopingAnim(playerid,"PED","WOMAN_walkbusy",4.1,1,1,1,1,1);
            case 17: LoopingAnim(playerid,"PED","WOMAN_walknorm",4.1,1,1,1,1,1);
            case 18: LoopingAnim(playerid,"PED","Walk_Wuzi",4.1,1,1,1,1,1)
        }
    }
    else if(RELEASED(KEY_WALK))
    {
        //Your code
    }
    return 1; //I don't know if this is the end of your callback, if it is don't delete it. If not, maybe yes. xD
}
Reply
#6

nm i see it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)