how to add weapon,s when player spawns
#1

well i need some help from u guys i cannot add weapon to the team which i wanted to give them when they spawn
i know how to add weapon we have to change the 1st 0 to weapon id and second to ammo thats all i knw if there is sumthing els we have to do for that then plz tell me
i tried changeing this zeros to weapon id and ammo and i complied but noting happend plz help me

Код:
// PlayerClasses
    // Aztecas //
    AddPlayerClassEx(0, 292, 1673.6190, -2122.3142,   14.1460, 296.6250, 0,0, 0,0, 0,0);
    AddPlayerClassEx(0, 115, 1673.6190, -2122.3142,   14.1460, 296.6250, 0,0, 0,0, 0,0.);
    AddPlayerClassEx(0, 116, 1673.6190, -2122.3142,   14.1460, 296.6250, 0,0, 0,0, 0,0);
    AddPlayerClassEx(0,  41, 1673.6190, -2122.3142,   14.1460, 296.6250, 0,0 0,0, 0,0);
Reply
#2

Hello, and it is for you
pawn Код:
public OnPlayerSpawn(playerid);
{
GivePlayerWeapon(playerid, 30, 50);
return 1;
}
This will give playerid weapon with id 30 with 50 rounds.
All clear? Have fun.

Greetz,
LetsOWN
Reply
#3

use this:


Put this in OnPlayerGameModeInt();

pawn Код:
AddPlayerClassEx(1, 292, 1673.6190, -2122.3142,   14.1460, 296.6250, 0,0, 0,0, 0,0);//These are the skin selection
AddPlayerClassEx(2, 115, 1673.6190, -2122.3142,   14.1460, 296.6250, 0,0, 0,0, 0,0.);
AddPlayerClassEx(3, 116, 1673.6190, -2122.3142,   14.1460, 296.6250, 0,0, 0,0, 0,0);
AddPlayerClassEx(4,  41, 1673.6190, -2122.3142,   14.1460, 296.6250, 0,0 0,0, 0,0);

public OnPlayerSpawn(playerid)
{
        ResetPlayerWeapons(playerid);
        GivePlayerWeapon(playerid, 31, 100);//Add ur custom weapons and their ammo.. then the players will get weapons on their spawn
    return 1;
}
Reply
#4

Quote:
Originally Posted by $$inSane
Посмотреть сообщение
use this:


Put this in OnPlayerGameModeInt();

pawn Код:
AddPlayerClassEx(1, 292, 1673.6190, -2122.3142,   14.1460, 296.6250, 0,0, 0,0, 0,0);//These are the skin selection
AddPlayerClassEx(2, 115, 1673.6190, -2122.3142,   14.1460, 296.6250, 0,0, 0,0, 0,0.);
AddPlayerClassEx(3, 116, 1673.6190, -2122.3142,   14.1460, 296.6250, 0,0, 0,0, 0,0);
AddPlayerClassEx(4,  41, 1673.6190, -2122.3142,   14.1460, 296.6250, 0,0 0,0, 0,0);

public OnPlayerSpawn(playerid)
{
        ResetPlayerWeapons(playerid);
        GivePlayerWeapon(playerid, 31, 100);//Add ur custom weapons and their ammo.. then the players will get weapons on their spawn
    return 1;
}
well thank u both of u but to be honest i realy dont knw nything about scripting plz tell me in detail wher shud i put this codes shud i replace it with existing codes or ?
Reply
#5

Okay. You can add weapons id and ammo of the weapon under the same function your using.

For example. This is your current function.
pawn Код:
AddPlayerClassEx(0, 292, 1673.6190, -2122.3142,   14.1460, 296.6250, 0,0, 0,0, 0,0);
Now this code will give Deagle of 100 ammo to the player who will select this skin. You can add three weapons here.
pawn Код:
AddPlayerClassEx(0, 292, 1673.6190, -2122.3142,   14.1460, 296.6250, 28,100, 0,0, 0,0);
28,100, 0,0, 0,0

Just change the other zeros as well.
Reply
#6

And my 5 cents about my code.

pawn Код:
GivePlayerWeapon(playerid, 30, 50);
If you paste any code below
pawn Код:
public onPlayerSpawn(playerid)
then everything what you did will be done for playerid only and only when he spawns.
Код:
GivePlayerWeapon(playerid, weaponid, ammo)
You can get all weaponid's here: SA-MP Wiki: Weapons
So if you want for example give player Minigun with 1000 rounds, then:
pawn Код:
GivePlayerWeapon(playerid, 38, 1000);
Easy, isnt it?

Wanna know anything else?

Head here:Have fun

Greetz,
LetsOWN
Reply
#7

Quote:
Originally Posted by Ballu Miaa
Посмотреть сообщение
Okay. You can add weapons id and ammo of the weapon under the same function your using.

For example. This is your current function.
pawn Код:
AddPlayerClassEx(0, 292, 1673.6190, -2122.3142,   14.1460, 296.6250, 0,0, 0,0, 0,0);
Now this code will give Deagle of 100 ammo to the player who will select this skin. You can add three weapons here.
pawn Код:
AddPlayerClassEx(0, 292, 1673.6190, -2122.3142,   14.1460, 296.6250, 28,100, 0,0, 0,0);
28,100, 0,0, 0,0

Just change the other zeros as well.
ballu bhai i already tried this and its not working :/

Quote:
Originally Posted by LetsOWN[PL]
Посмотреть сообщение
And my 5 cents about my code.

pawn Код:
GivePlayerWeapon(playerid, 30, 50);
If you paste any code below
pawn Код:
public onPlayerSpawn(playerid)
then everything what you did will be done for playerid only and only when he spawns.
Код:
GivePlayerWeapon(playerid, weaponid, ammo)
You can get all weaponid's here: SA-MP Wiki: Weapons
So if you want for example give player Minigun with 1000 rounds, then:
pawn Код:
GivePlayerWeapon(playerid, 38, 1000);
Easy, isnt it?

Wanna know anything else?

Head here:Have fun

Greetz,
LetsOWN
ok i will try this and then will tell u thnx for help
Reply
#8

Mere bhai then use AddPlayerClass function. Not the AddPlayerClassEx function.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)