SetPlayerSkillLevel help
#1

I just see this great function, but is there any way to get the player Skill level in the weapon?
I want to give more skill points after kill someone...

Is it possible?

I haven't found any Getplayerskilllevel yet xD
Reply
#2

Just store it manually?
Reply
#3

You could do a Temporary Fix till it might be added

WARNING! This is just an Alternative and isn't ensured to work the way you want!

Top of your script:
pawn Код:
new WeaponSkill[MAX_PLAYERS][11];
Somewhere in your code:
pawn Код:
stock SetPlayerSkillLevelEx(playerid, skill, level)
{
    if(IsPlayerConnected(playerid))
    {
    SetPlayerSkillLevel(playerid, skill, level);
    WeaponSkill[playerid][skill] = level;
    }
    return 1;
}

stock GetPlayerSkillLevelEx(playerid, skill)
{
    if(IsPlayerConnected(playerid))
    {
    new skillStr[128];
    format(skillStr, sizeof(skillStr), "Current Stats for Skill Level %d | Skill level: %d", skill, WeaponSkill[playerid][skill]);
    SendClientMessage(playerid, 0xFFFFFFFF, skillStr);
    }
    return 1;
}
Your new functions:

SetPlayerSkillLevelEx(playerid, skill, level, mode);
playerid - The playerid you want to EDIT the Skill level of.
skill - The Skill ID you want to change [Check https://sampwiki.blast.hk/wiki/Skillweapons for more info]
level - The Skill level the player skill should be from 0-1000
__________________________________________________ __________________________________________________ ___
GetPlayerSkillLevelEx(playerid, skill);

playerid The playerid you to to GET the Skill level of.
skill - The Skill ID you want to get [Check https://sampwiki.blast.hk/wiki/Skillweapons for more info]


enjoy



Reply
#4

0 = poor
100-300 = gangster
400-600 = ?
700-1000 = hitman
Reply
#5

Using Tashla's code, add it to OnPlayerDeath;

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(reason == 22)
{
new skill;
skill = WeaponSkill[playerid][0]+100;
SetPlayerSkillLevelEx(killerid, WEAPONSKILL_PISTOL, skill)
}
}
Or something like above,

Remember: The skill IDs are NOT the same as the weapon IDs, see the wiki page for SetPlayerSkillLevel.


Quote:
Originally Posted by Moustafa
0 = poor
100-300 = gangster
400-600 = ?
700-1000 = hitman
400-600 = Thug, I think.
Reply
#6

Quote:
Originally Posted by Tashla
You could do a Temporary Fix till it might be added

WARNING! This is just an Alternative and isn't ensured to work the way you want!

Top of your script:
pawn Код:
new WeaponSkill[MAX_PLAYERS][11];
Somewhere in your code:
pawn Код:
stock SetPlayerSkillLevelEx(playerid, skill, level)
{
    if(IsPlayerConnected(playerid))
    {
    SetPlayerSkillLevel(playerid, skill, level);
    WeaponSkill[playerid][skill] = level;
    return 1;
    }
}

stock GetPlayerSkillLevelEx(playerid, skill)
{
    if(IsPlayerConnected(playerid))
    {
    new skillStr[128];
    format(skillStr, sizeof(skillStr), "Current Stats for Skill Level %d | Skill level: %d", skill, WeaponSkill[playerid][skill]);
    SendClientMessage(playerid, 0xFFFFFFFF, skillStr);
    return 1;
    }
}
Your new functions:

SetPlayerSkillLevelEx(playerid, skill, level);

playerid - The playerid you want to EDIT the Skill level of.
skill - The Skill ID you want to change [Check https://sampwiki.blast.hk/wiki/Skillweapons for more info]
level - The Skill level the player skill should be from 0-1000
__________________________________________________ __________________________________________________ ___
GetPlayerSkillLevelEx(playerid, skill);

playerid The playerid you to to GET the Skill level of.
skill - The Skill ID you want to get [Check https://sampwiki.blast.hk/wiki/Skillweapons for more info]


pawn Код:
stock SetPlayerSkillLevelEx(playerid, skill, level)
{
    if(IsPlayerConnected(playerid))
    {
    SetPlayerSkillLevel(playerid, skill, level);
    WeaponSkill[playerid][skill] = level;
    return 1;
    }
}

stock GetPlayerSkillLevelEx(playerid, skill)
{
    if(IsPlayerConnected(playerid))
    {
    return WeaponSkill[playerid][skill];
    }
return -1;
}
GetPlayerSkillLevelEx is supposed to return the skill level, not some stupid message..

enjoy



Reply
#7

http://www.gtagaming.com/sanandreas/weaponskills
Reply
#8

Edited my code a little! Now allows a Bool:mode so you can either choose + or - value.

Example (thank you Calgon):
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  if(reason == 22) //Check if the weapon is a Pistol
  {
  SetPlayerSkillLevelEx(playerid, skill, GetPlayerSkillLevelEx(playerid,skill)+100);
  }
  return 1;
}
Reply
#9

Quote:
Originally Posted by Tashla
You could do a Temporary Fix till it might be added
say to me if i make a mistake, but this will store the point also if player is goes offline?
For ex. if i play with id 10, i make 999 skill in weap, then i exit the game, the next player who will have id 10 also have 999 of skill (until the server restart) Right?
Also...
MAX_PLAYERS includes Max users + bots started?
Because id starts from 6, with the default GM (5 are reserved to bots) and in this way this script can manage only the max players - the bots playing.
Reply
#10

Mode is pretty stupid,

people know just to:

pawn Код:
SetPlayerSkillLevelEx(playerid, skill, level+100);
or

pawn Код:
SetPlayerSkillLevelEx(playerid, skill, level-100);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)