How to get that?
#1

How get that is player shoot? like i want make wehn player 1 shoot he taked off 1 variable.. how make this?
Reply
#2

Add this at OnPlayerStateKeyChange

pawn Код:
if(newkeys == KEY_FIRE || newkeys == KEY_SECONDARY_FIRE)
{
    SetPVarInt(playerid, "Shot", GetPVarInt(playerid, "Shot")-1);
}
If it give errors, try:

pawn Код:
if(newkeys == KEY_FIRE || newkeys == KEY_SECONDARY_FIRE)
{
    SetPVarInt(playerid, "Shot", GetPVarInt(playerid, "Shot")-1;
}
Reply
#3

Buyt how when i make - 1 in PlayerInfo?
Reply
#4

Quote:
Originally Posted by whitedragon
Посмотреть сообщение
Buyt how when i make - 1 in PlayerInfo?
pawn Код:
if(newkeys == KEY_FIRE || newkeys == KEY_SECONDARY_FIRE)
{
    SetPVarInt(playerid, "Shot", GetPVarInt(playerid, "Shot")-1);
    new file[50], name[20], str[50];
    GetPlayerName(playerid, name, 20);
    format(file, sizeof(file),"users/%s.ini", name);
    new File:account = fwrite(file, io_append);
    if(account)
    {
        format(str, 50, "Shots: %d", GetPVarInt(playerid, "Shot"));
        { fwrite(account, str); }
        fclose(account);
    }
}
Try this, not sure
Reply
#5

Quote:
Originally Posted by whitedragon
Посмотреть сообщение
Buyt how when i make - 1 in PlayerInfo?
if you do it like:
PlayerInfo[playerid][shoot]
then make:

Код:
PlayerInfo[playerid][shoot]--;
Reply
#6

Quote:
Originally Posted by Sascha
Посмотреть сообщение
if you do it like:
PlayerInfo[playerid][shoot]
then make:

Код:
PlayerInfo[playerid][shoot]--;
pawn Код:
if(newkeys == KEY_FIRE || newkeys == KEY_SECONDARY_FIRE)
{
    PlayerInfo[playerid][shoot]--;
}
Reply
#7

But how check weapon?
Reply
#8

Read the goddamn wiki. https://sampwiki.blast.hk/wiki/GetPlayerWeapon
Second, I say all the time to NOT check for a key with a simple '=='. This is also explained on the wiki.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)