[HELP]OnPlayerCommandText its bug
#1

why my OnPlayerCommandText is bug if im in game i type /sb or /seatbelt wont work its said "Unknown Command" help me please ASAP!!


here the code
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new string[256];
    new cmd[256];
    new tmp[256];
    new giveplayer[MAX_PLAYER_NAME];
    new giveplayerid, idx;
    cmd = strtok(cmdtext, idx);
    new sendername[MAX_PLAYER_NAME];
    if(strcmp(cmd,"/sb",true)==0)
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
        {
            SendClientMessage(playerid,COLOR_GREY,"You need to be in a vehicle.");
            return 1;
        }
        if(PlayerInfo[playerid][pSeatBelt] == 1)
        {
            PlayerInfo[playerid][pSeatBelt] = 0;
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new stringtosee[255];
            format(stringtosee, sizeof(stringtosee), "*** %s unbuckles his/her seatbelt.", sendername);
            ProxDetector(30.0, playerid, stringtosee, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA);
            return 1;
        }
        PlayerInfo[playerid][pSeatBelt] = 1;
        GetPlayerName(playerid, sendername, sizeof(sendername));
        new stringtosee[255];
        format(stringtosee, sizeof(stringtosee), "*** %s buckles his/her seatbelt.", sendername);
        ProxDetector(30.0, playerid, stringtosee, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA);
    }
//Checking seatbelt
    if(strcmp(cmd, "/checksb", true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_GREY, "USAGE: /checksb [playerid]");
            return 1;
        }
        new playa;
        if(strlen(tmp))
        {
            playa = ReturnUser(tmp);
        }
        else
        {
            playa = strval(tmp);
        }
        if(GetPlayerState(playa) == PLAYER_STATE_ONFOOT)
        {
            SendClientMessage(playerid,COLOR_GREY,"Player isn't in a vehicle.");
            return 1;
        }
        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
        GetPlayerName(playerid, sendername, sizeof(sendername));
        if(IsAPoliceSkin(playerid))
        {
            giveplayerid = ReturnUser(tmp);
            if(ProxDetectorS(9.0, playerid, giveplayerid))
            {
                new stext[255];
                if(PlayerInfo[playa][pSeatBelt] == 0)
                {
                    stext = "off";
                }
                else if(PlayerInfo[playa][pSeatBelt] == 1)
                {
                    stext = "on";
                }
                format(string, sizeof(string), "%s have the seatbelt %s." , giveplayer , stext);
                SetPlayerChatBubble(playerid, string, COLOR_PURPLE, 30.0, 6000);
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "That player is not near you!");
            }
        }
        else
        {
            SendClientMessage(playerid,COLOR_GREY,"You're not an Police Officer!");
        }
        return 1;
    }
    return 0;
}
public IsAPoliceSkin(skinid)
{
    if((skinid >= 265 && skinid <= 266) || (skinid == 267) || (skinid == 280) || (skinid == 281) || (skinid == 282) || (skinid == 283) || (skinid == 284) || (skinid == 285) || (skinid == 286) || (skinid == 287) || (skinid == 288))
    {
        return 1;
    }
    return 0;
}
Reply


Messages In This Thread
[HELP]OnPlayerCommandText its bug - by BoneCrash - 20.01.2012, 05:03
Re: [HELP]OnPlayerCommandText its bug - by Konstantinos - 22.01.2012, 11:15
Re: [HELP]OnPlayerCommandText its bug - by BoneCrash - 24.01.2012, 04:04
Re: [HELP]OnPlayerCommandText its bug - by Vince - 29.01.2012, 10:53
Re: [HELP]OnPlayerCommandText its bug - by Konstantinos - 29.01.2012, 10:58
Re: [HELP]OnPlayerCommandText its bug - by Scones - 29.01.2012, 11:10
Re: [HELP]OnPlayerCommandText its bug - by BoneCrash - 31.01.2012, 11:41
Re: [HELP]OnPlayerCommandText its bug - by BoneCrash - 01.02.2012, 08:47
Re: [HELP]OnPlayerCommandText its bug - by MP2 - 01.02.2012, 09:25
Re: [HELP]OnPlayerCommandText its bug - by BoneCrash - 03.02.2012, 05:18

Forum Jump:


Users browsing this thread: 1 Guest(s)