setskilllevel
#1

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);
Reply
#2

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;
}
Reply
#3

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);
Reply
#4

thank you very much. is it possible to do this without sscanf and zcmd?
Reply
#5

Without zcmd yes.
Without sscanf yes but the process without sscanf is slow.
Reply
#6

Can you show me how to do it without them? It's a simple command, shouldn't take much resource...
Reply
#7

sscanf is a resource that uses less resources. So is ZCMD.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)