[HELP] OnPlayerKeyStateChange.
#1

I make a command for PD (with space) - that he can take weapons, armour and so. But there is a 'bug' - i take one and they came again

pawn Code:
if( newkeys == KEY_SPRINT )
    {
    if(IsPlayerInRangeOfPoint(playerid, 3.0, 254.1305,79.0468,1003.6406))
    {
    if(PlayerInfo[playerid][pMember] == 1)
    {
    new string1[256], string2[256], string3[1500];
    strcat(string1, "{FF8000}Dostupne opreme \n\n");
    strcat(string2, "\t{FFFFFF}-Basic oprema - u njoj dobivate Pendrek, Deagle, Shotgun i MP5 \n\t-Extreme oprema - u njoj dobivate Spaz12 i M4.");
    format(string3, sizeof(string3), "%s%s", string1, string2);
    ShowPlayerDialog(playerid, 12, DIALOG_STYLE_MSGBOX, "{FF8000}POLICE DEPARTMENT - OPREMA", string3, "Basic", "Extreme");
    }
    }
    }
    return 1;
}
pawn Code:
if(dialogid == 12)
    {
    if(response == 1)
    {
                new sendername[MAX_PLAYER_NAME];
                new string[128];
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "* Policajac %s uzima svoju opremu iz ormarica.", sendername);
                ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                ResetPlayerWeapons(playerid);
                GivePlayerWeapon(playerid, 3, 1);
                GivePlayerWeapon(playerid, 24, 100);
                GivePlayerWeapon(playerid, 25, 100);
                GivePlayerWeapon(playerid, 29, 200);
                SetPlayerHealth(playerid, 100);
                SetPlayerArmour(playerid, 100);
    }
    else if(response == 0)
    {
    if(PlayerInfo[playerid][pRank] >= 3)
    {
                new sendername[MAX_PLAYER_NAME];
                new string[128];
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "* Policajac %s uzima svoju opremu iz ormarica.", sendername);
                ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                ResetPlayerWeapons(playerid);
                GivePlayerWeapon(playerid, 27, 50);
                GivePlayerWeapon(playerid, 31, 200);
                GivePlayerWeapon(playerid, 24, 100);
                SetPlayerHealth(playerid, 100);
                SetPlayerArmour(playerid, 100);
                SetPlayerSkin(playerid, 285);
    }
    }
    }
Video: Show it

http://www.youtube.com/watch?v=4Gc_w...ature=*********
Reply
#2

Use 'Bitwise' operator for Checking KeyPress, not '=='. Read: https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange

and add 'return 1;' at end of every 'if' or 'else if' block.
Reply
#3

REMOVED!!!
Reply
#4

I dont understand.

Can you make me this command - please.

Rep++
Reply
#5

bump please
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)