Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] Help with DM

 
  • 0 Vote(s) - 0 Average
Pawn Help with DM
DaZzY
Offline

Burgershot Member
Posts: 74
Threads: 12
Joined: Oct 2020
Reputation: 2
#1
2020-10-29, 12:29 AM (This post was last modified: 2020-10-29, 12:34 AM by DaZzY.)
Hello ! 

I have created a DM on my Gamemode 

And i have idea to add on my DM 

I want a killer on DM get a  new weapon when he kill another player 

Example Player have A Shotgun when he kill another player the killer get another weapon Sniper 

and when he kill another again he get another weapon Sawnoff .... 

I don't know how to start scripting this ... 

Can someone give me just base and some explication please :)  

its easy for me to give a player weapon on DM for second kill but hard for me to add weapon for each other kill ( thirst kill ,4 kill .... ) 
Freaksken
Offline

open.mp Developer

Posts: 80
Threads: 4
Joined: Feb 2019
Reputation: 6
Location: Belgium
#2
2020-10-29, 01:41 PM (This post was last modified: 2020-10-29, 01:47 PM by Freaksken.)
Top of script:
Code:
// Array with the order of the weapons you want
new weapons[] = {WEAPON_SHOTGUN, WEAPON_SNIPER, WEAPON_SAWEDOFF};

// Array with the amount of kills for each player
new kills[MAX_PLAYERS] = {0, ...};

OnPlayerConnect:
Code:
public OnPlayerConnect(playerid)
{
    // Reset playerid kills on connect
    kills[playerid] = 0;

    // Give playerid first weapon with 1000 ammo
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid, weapons[0], 1000);
    return 1;
}

OnPlayerDeath:
Code:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid != INVALID_PLAYER_ID) {
        // Increase killerid kills
        kills[killerid]++;

        //Give killerid new weapon with 1000 ammo when there are more weapons, otherwise keep last weapon
        if(kills[killerid] < sizeof(weapons)) {
            ResetPlayerWeapons(killerid);
            GivePlayerWeapon(killerid, weapons[kills[killerid]], 1000);
        }
    }

    // Reset playerid kills on death
    kills[playerid] = 0;
    return 1;
}
Always keep in mind that a lot of people are active on this forum in their spare time.
They are sacrificing time they could easily spend on things they would rather do, to help you instead.
DaZzY
Offline

Burgershot Member
Posts: 74
Threads: 12
Joined: Oct 2020
Reputation: 2
#3
2020-10-29, 02:31 PM
Thank You thats what i want to start :D
Awide
Offline

Burgershot Member
Posts: 62
Threads: 5
Joined: Sep 2019
Reputation: 5
#4
2020-10-29, 04:30 PM
This one gives a totally random gun whenever the player kills someone.
Code:
public OnPlayerDeath(playerid, killerid, reason) {
    if(killerid != INVALID_PLAYER_ID) {
            ResetPlayerWeapons(killerid);
            GivePlayerWeapon(killerid, random(15)+22, 1000);
        }
    }
    return 1;
}
Desolation Roleplay has closed. You can download the gamemode here: https://www.burgershot.gg/showthread.php?tid=2272
Expert*
Offline

Burgershot Member
Posts: 61
Threads: 2
Joined: Apr 2019
Reputation: 4
#5
2020-10-30, 07:31 PM
You should avoid weapons that don't fire bullets like Rpg and Heat seeking rocket. IMO.

So, random(13) ?
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode