SA-MP Forums Archive
Help with weapon skill - 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: Help with weapon skill (/showthread.php?tid=622397)



Help with weapon skill - Markoni990 - 21.11.2016

Hi all, can someone tell me how to make skill for weapon or tell me where i made a mistake, when someone kill a player to get 10+ skill for deagle example.
Код:
if(killerid != INVALID_PLAYER_ID)
{
PlayerInfo[killerid][pDesert] += 10, SetPlayerSkillLevel(playerid, WEAPONSKILL_DESERT_EAGLE, PlayerInfo[playerid][pDesert]);
PlayerInfo[killerid][pShotgun] += 10, SetPlayerSkillLevel(playerid, WEAPONSKILL_SHOTGUN, PlayerInfo[playerid][pShotgun]);
PlayerInfo[killerid][pCombat] += 10, SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, PlayerInfo[playerid][pCombat]);
PlayerInfo[killerid][pMP5] += 10, SetPlayerSkillLevel(playerid, WEAPONSKILL_MP5, PlayerInfo[playerid][pMP5]);
PlayerInfo[killerid][pAK47] += 10, SetPlayerSkillLevel(playerid, WEAPONSKILL_AK47, PlayerInfo[playerid][pAK47]);
PlayerInfo[killerid][pM4] += 10, SetPlayerSkillLevel(playerid, WEAPONSKILL_M4, PlayerInfo[playerid][pM4]);
}



Re: Help with weapon skill - Markoni990 - 21.11.2016

BUMP HELP PLS


Re: Help with weapon skill - Jelly23 - 21.11.2016

Just look for the death reason (weaponid), then increase the skills for that weapon.

Ex:
PHP код:
if(reason == 24)
{
     
PlayerInfo[killerid][pDesert] += 10SetPlayerSkillLevel(playeridWEAPONSKILL_DESERT_EAGLEPlayerInfo[playerid][pDesert]);




Re: Help with weapon skill - Markoni990 - 21.11.2016

Can you explain a little bit better please.?


Re: Help with weapon skill - GoldenLion - 21.11.2016

Just create a variable where you store player's weapon skill and increase it when they kill someone with that weapon. For example a variable called DeagleSkill for each player and when player kills someone with a deagle you add 10 to DeagleSkill and set player's weapon skill to the current one. Just like the guy above replied. You can use per-player variables (they are slower than normal variables though) or create an array as well.


Re: Help with weapon skill - Markoni990 - 21.11.2016

I found a solution. Lock this