Question
#1

Hey guys. I am new at scripting. Can someone show me how to give player weapon when he joins the server? Thanks.
Reply
#2

Hey. Find a callback called OnPlayerSpawn, inside it add this function:
Код:
GivePlayerWeapon(playerid, weaponid, ammo);
You can get weapon ids from here: https://sampwiki.blast.hk/wiki/Weapons
Reply
#3

What does mapping have to do with this?

Anyway: You need to use the callback called "OnPlayerConnect". This has a single parameter of (playerid). You can view the wiki page here: https://sampwiki.blast.hk/wiki/OnPlayerConnect
pawn Код:
public OnPlayerConnect(playerid)
{
   
    return 1;
}
You will also need the GivePlayerWeapon function, which has three parameters: (playerid, weaponid, ammo). You can view the wiki page here: https://sampwiki.blast.hk/wiki/GivePlayerWeapon

pawn Код:
GivePlayerWeapon(playerid, weaponid, ammo);
Combining those two will give you:
pawn Код:
public OnPlayerConnect(playerid)
{
     GivePlayerWeapon(playerid, weaponid, ammo);
     return 1; //Always return 1 to allow this callback to continue into filterscripts.
}
You will obviously need to fill out weaponid and ammo yourself, as I don't know what weapon/ammo amount you want. You can get the weaponid from the wiki, and the ammo amount is up to you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)