SA-MP Forums Archive
Creating a gungame system with score! - 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: Creating a gungame system with score! (/showthread.php?tid=332390)



Creating a gungame system with score! - Facepunch - 08.04.2012

Hi there! I'm currently trying to create a gun game, developed using samp's LVDM gamemode.

What I need help with is how to set up the if's and else's when it comes to giving weapons..

If your familiar with "gun games", then what I want is to basically tell the script that when a player gets 1 score after a kill, he'll get a new weapon.

So basically I was going in the direction where the script would contain:
pawn Code:
if GetPlayerScore = 1
{
giveplayerweapon....

else if
getplayerscore = 2
giveplayerweapon...

Do you get what I mean?
If you can assist me with this for free, I would be much obliged...

I'm looking forward to hearing from you!

Sincerely, Facepunch


Re: Creating a gungame system with score! - Catalyst- - 08.04.2012

pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid != INVALID_PLAYER_ID)
    {
        new score = GetPlayerScore(killerid);
        SetPlayerScore(killerid, score + 1);
        if(score == 5)
        {
            GivePlayerWeapon(killerid, WeaponID, Ammo);
        }
        else if(score == 10)
        {
            GivePlayerWeapon(killerid, WeaponID, Ammo);
        }
        else if(score == 15)
        {
            GivePlayerWeapon(killerid, WeaponID, Ammo);
        }
        // etc...
    }
    return 1;
}
https://sampwiki.blast.hk/wiki/Weapons
All you have to do is, replace WeaponID with the weapons you want to give players, and Ammo with the amount of ammo you want to give them.


Re: Creating a gungame system with score! - [DOG]irinel1996 - 08.04.2012

You mean change player's weapon after each kill?