SA-MP Forums Archive
How to get that? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to get that? (/showthread.php?tid=168472)



How to get that? - whitedragon - 16.08.2010

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


Re: How to get that? - Claude - 16.08.2010

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;
}



Re: How to get that? - whitedragon - 16.08.2010

Buyt how when i make - 1 in PlayerInfo?


Re: How to get that? - Claude - 16.08.2010

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


Re: How to get that? - Sascha - 16.08.2010

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]--;



Re: How to get that? - (.Aztec); - 16.08.2010

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]--;
}



Re: How to get that? - whitedragon - 18.08.2010

But how check weapon?


Re: How to get that? - Vince - 18.08.2010

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.