SA-MP Forums Archive
[Include] Set/GetPlayerSkillLevelEx - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] Set/GetPlayerSkillLevelEx (/showthread.php?tid=277595)



Set/GetPlayerSkillLevelEx - Riddick94 - 18.08.2011

Hello

I don't understand why a lot of people got problem with GetPlayerSkillLevel. Okey so i made it for lazy people what won't make this or they're too..

Description

I made this in few minutes. there's only two functions to use:
pawn Код:
native GetPlayerSkillLevelEx(playerid, weapon_skill_id);
native SetPlayerSkillLevelEx(playerid, weapon_skill_id, skill_value);
Saving & Loading?

I will show you how to do this by using Y_Ini system (by ******).

Saving:
pawn Код:
new INI:Account = INI_Open(PlayerFile(playerid));
INI_WriteInt(Account,     "WEAPON_SKILL_PISTOL",    GetPlayerSkillLevelEx(playerid, WEAPONSKILL_PISTOL));
INI_Close   (Account);
Loading:
pawn Код:
function LoadPlayerStats(playerid, name[], value[])
{
    if(!strcmp(name, "WEAPON_SKILL_PISTOL"))    GetPlayerSkillLevelEx(playerid, strval(value));
    return true;
}
Set when player spawn:
pawn Код:
INI_ParseFile(PlayerFile(playerid), "LoadPlayerStats", .bExtra = true, .extra = playerid);
SetPlayerSkillLevelEx(playerid, WEAPONSKILL_PISTOL, GetPlayerSkillLevelEx(playerid, WEAPONSKILL_PISTOL));
And that's all!

Bugs:

In my script? hah.. :>

Need help with saving?

Tell us about your saving & loading system and we (or me) will try to help you out your problem.

Download:

Source (Pastebin)
Include
FilterScript



Re: Set/GetPlayerSkillLevelEx - Kaperstone - 18.08.2011

nice!! thanks


Re: Set/GetPlayerSkillLevelEx - Riddick94 - 18.08.2011

I am here from a lot of time (Join Date: 28/03/2010) and it's my first release because i was helping just people in Scripting Discussion. I saw they got problem with this and one of them get banned for spamming and 'no knowledge' about PAWN. So.. i made it for them.

Thank you for the first opinion. Maybe some other comments?


Re: Set/GetPlayerSkillLevelEx - Toreno - 18.08.2011

It's useless becuase you can do it a simple stock and post it at Useful Functions, like this;
Easier way.
pawn Код:
new PlayerWeaponSkill[MAX_PLAYERS][11];
pawn Код:
stock _SetPlayerSkillLevel(playerid, skill, level) {
    if(level > 999) PlayerWeaponSkill[playerid][skill] = 999;
    else if(level < 0) PlayerWeaponSkill[playerid][skill] = 0;
    else PlayerWeaponSkill[playerid][skill] = level;
    return SetPlayerSkillLevel(playerid, skill, level);
}
#define SetPlayerSkillLevel _SetPlayerSkillLevel
pawn Код:
stock GetPlayerSkillLevel(playerid, skill) return PlayerWeaponSkill[playerid][skill];
But, good job for doing such a thing.


Re: Set/GetPlayerSkillLevelEx - Darnell - 18.08.2011

Nice for first release.


Re: Set/GetPlayerSkillLevelEx - Riddick94 - 18.08.2011

Yes. Sometimes we can think more to do something just like you. I made this on switch's because i was thinking about them. Your way is good too and i have an other way too. But it's in my Experience/Level system and i just won't to release it


Re: Set/GetPlayerSkillLevelEx - playbox12 - 18.08.2011

Quote:
Originally Posted by Riddick94
Посмотреть сообщение
Hello

I don't understand why a lot of people got problem with GetPlayerSkillLevel. Okey so i made it for lazy people what won't make this or they're too..
Because there is no GetPlayerSkillLevel..? Good job, funny thing I was helping a guy yesterday who had the same problem, sure quite some find it usefull.


Re: Set/GetPlayerSkillLevelEx - Kaperstone - 18.08.2011

pawn Код:
SetPlayerSkillLevelEx(playerid, weapon_skill_id, skill_value);
whats the max "skill_value" ?


Re: Set/GetPlayerSkillLevelEx - Riddick94 - 18.08.2011

Your value of skill.

https://sampwiki.blast.hk/wiki/SetPlayerSkillLevel

skill = weapon_skill_id.
skill_value = level.

P.S
500 post.. new level - Gangsta on forum


Re: Set/GetPlayerSkillLevelEx - Kaperstone - 18.08.2011

Quote:
Originally Posted by Riddick94
Посмотреть сообщение
Your value of skill.

https://sampwiki.blast.hk/wiki/SetPlayerSkillLevel

skill = weapon_skill_id.
skill_value = level.

P.S
500 post.. new level - Gangsta on forum
Congratulations
and thanks