SA-MP Forums Archive
[HELP] OnPlayerKeyStateChange. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP] OnPlayerKeyStateChange. (/showthread.php?tid=362408)



[HELP] OnPlayerKeyStateChange. - Edin Black - 24.07.2012

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=*********


Re: [HELP] OnPlayerKeyStateChange. - Minion - 24.07.2012

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.


Re: [HELP] OnPlayerKeyStateChange. - Cjgogo - 24.07.2012

REMOVED!!!


Re: [HELP] OnPlayerKeyStateChange. - Edin Black - 24.07.2012

I dont understand.

Can you make me this command - please.

Rep++


Re: [HELP] OnPlayerKeyStateChange. - Edin Black - 24.07.2012

bump please