Whats wrong with this?
#1

pawn Код:
CMD:surrender(playerid,params[])
{
    if(PlayerInfo[playerid][pTeam] ==0)
    {
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP);
        PlayerInfo[playerid][pSurrender] = 1;
    }
    else if(PlayerInfo[playerid][pSurrender] ==1)
    {
        ClearAnimations(playerid);
        PlayerInfo[playerid][pSurrender] = 0;
    }
    return 1;
}
It just dosnt work. I dont get a Unkown Command, am i just not activating Hands up?
Reply
#2

This does not support on Sscanf.

Try using strmp.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/surrender", cmdtext, true, 10) == 0)
    {
        if(PlayerInfo[playerid][pTeam] ==0)
    {
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP);
        PlayerInfo[playerid][pSurrender] = 1;
    }
    else (PlayerInfo[playerid][pSurrender] ==1)
    }
        ClearAnimations(playerid);
        PlayerInfo[playerid][pSurrender] = 0;
    }
    return 1;
}
    return 0;
}
Reply
#3

Quote:
Originally Posted by Shockey HD
Посмотреть сообщение
pawn Код:
CMD:surrender(playerid,params[])
{
    if(PlayerInfo[playerid][pTeam] ==0)
    {
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP);
        PlayerInfo[playerid][pSurrender] = 1;
    }
    else if(PlayerInfo[playerid][pSurrender] ==1)
    {
        ClearAnimations(playerid);
        PlayerInfo[playerid][pSurrender] = 0;
    }
    return 1;
}
It just dosnt work. I dont get a Unkown Command, am i just not activating Hands up?
Did you remove the "OnPlayerCommandText" callback from your script?
Reply
#4

Quote:
Originally Posted by Alex_Obando
Посмотреть сообщение
This does not support on Sscanf.

Try using strmp.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/surrender", cmdtext, true, 10) == 0)
    {
        if(PlayerInfo[playerid][pTeam] ==0)
    {
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP);
        PlayerInfo[playerid][pSurrender] = 1;
    }
    else (PlayerInfo[playerid][pSurrender] ==1)
    }
        ClearAnimations(playerid);
        PlayerInfo[playerid][pSurrender] = 0;
    }
    return 1;
}
    return 0;
}
Why would i use strcmp?

Strcmp= Slow

Yes, OnPlayerCommandText is removed. I changed it so the code looks like this.


pawn Код:
CMD:surrender(playerid,params[])
{
    if(PlayerInfo[playerid][pSurrender] ==0)
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
        {
            ApplyAnimation(playerid,"ROB_BANK","SHP_HandsUp_Scr",4.1,1,1,1,1,1,1);
            TogglePlayerControllable(playerid,0);
            PlayerInfo[playerid][pSurrender] = 1;
        }
    }
    else if(PlayerInfo[playerid][pSurrender] ==1)
    {
        ClearAnimations(playerid);
        PlayerInfo[playerid][pSurrender] = 0;
        TogglePlayerControllable(playerid,1);
    }
    return 1;
}

But it still dosnt work
Reply
#5

Quote:
Originally Posted by Shockey HD
Посмотреть сообщение
Why would i use strcmp?

Strcmp= Slow

Yes, OnPlayerCommandText is removed. I changed it so the code looks like this.


pawn Код:
CMD:surrender(playerid,params[])
{
    if(PlayerInfo[playerid][pSurrender] ==0)
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
        {
            ApplyAnimation(playerid,"ROB_BANK","SHP_HandsUp_Scr",4.1,1,1,1,1,1,1);
            TogglePlayerControllable(playerid,0);
            PlayerInfo[playerid][pSurrender] = 1;
        }
    }
    else if(PlayerInfo[playerid][pSurrender] ==1)
    {
        ClearAnimations(playerid);
        PlayerInfo[playerid][pSurrender] = 0;
        TogglePlayerControllable(playerid,1);
    }
    return 1;
}

But it still dosnt work
Okay, add the "OnPlayerCommandText" callback back into your script. I had this problem too, where commands quit working unless that callback was there. You can just do this:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[]) return 0;
Reply
#6

It should work what RealCop228 said
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)