setskilllevel - 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: setskilllevel (
/showthread.php?tid=389495)
setskilllevel -
HeLiOn_PrImE - 02.11.2012
Hey guys, i need a simple command that will set a player's weapon skill level the ammount I want.
I know it's possible using sscanf and zcmd, but I tried many times and I failed.
I need something like this: /setskill <playerID> <ammount>
to do this:
Код:
SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, ammount);
Re: setskilllevel -
[D]ry[D]esert - 02.11.2012
pawn Код:
CMD:setskill(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
new targetid,ammount;
if(sscanf(params, "ui",targetid,ammount)) return SendClientMessage(playerid,-1,"[ERROR]/setskill <playerid> <ammount>");
SetPlayerSkillLevel(targetid, WEAPONSKILL_SAWNOFF_SHOTGUN, ammount);
}
return 1;
}
Re: setskilllevel -
MP2 - 02.11.2012
Here's an array you can use for all weapons:
pawn Код:
new const gWeaponSkilla[] = {
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
0, // Colt 45 (9mm)
1, // Silenced Pistol
2, // Desert Eagle
3, // Shotgun
4, // Sawn-off
5, // Combat Shotgun
6, // Micro SMG
7, // MP5
8, // AK-47
9, // M4
6, // Micro SMG (Tec9)
-1,
-1 // Sniper (no effect)
};
SetPlayerSkillLevel(playerid, gWeaponSkill[weaponid], level);
Re: setskilllevel -
HeLiOn_PrImE - 02.11.2012
thank you very much. is it possible to do this without sscanf and zcmd?
Re: setskilllevel -
JaKe Elite - 02.11.2012
Without zcmd yes.
Without sscanf yes but the process without sscanf is slow.
Re: setskilllevel -
HeLiOn_PrImE - 02.11.2012
Can you show me how to do it without them? It's a simple command, shouldn't take much resource...
Re: setskilllevel -
MP2 - 02.11.2012
sscanf is a resource that uses less resources. So is ZCMD.