Question - 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: Question (
/showthread.php?tid=305765)
Question -
areddy2 - 23.12.2011
Hey guys. I am new at scripting. Can someone show me how to give player weapon when he joins the server? Thanks.
Re: Question -
Universal - 23.12.2011
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
Re: Question -
Ash. - 23.12.2011
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.