The Boss
Новичок
Система скиллов по патронам
в начало мода
к Форвардам
К переменным
В enum pinfo
В OnPlayerConnect
В конец мода или в любое свободное место
В OnPlayerSpawn
В OnPlayerUpdate
К командам:
Автор: неизвестно
Будут какие то ошибки или вопросы пишите чем смогу помогу, система рабочая.
И еще не забудьте Загрузку/Cохранение скиллов сделать (pGunSkill)
в начало мода
PHP:
////////////////////////КОЛ.ВО ПАТРОНОВ ДЛЯ 1% СКИЛЛА///////////////////////////
#define Ammo_SDPISTOL 15
#define Ammo_DEAGLE 15
#define Ammo_SHOTGUN 10
#define Ammo_MP5 30
#define Ammo_AK47 30
#define Ammo_M4A1 30
PHP:
forward OnPlayerAmmoChange(playerid, newammo, oldammo);
PHP:
new iNewPlayerAmmo[MAX_PLAYERS];
PHP:
pGunSkill[5],
PHP:
PlayerInfo[playerid][pGunSkill][0] = 0; PlayerInfo[playerid][pGunSkill][1] = 0; PlayerInfo[playerid][pGunSkill][2] = 0;
PlayerInfo[playerid][pGunSkill][3] = 0; PlayerInfo[playerid][pGunSkill][4] = 0; PlayerInfo[playerid][pGunSkill][5] = 0;
PHP:
//==============================================================================
stock SetPlayerSkills(playerid)
{
SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, PlayerInfo[playerid][pGunSkill][0]*10);
SetPlayerSkillLevel(playerid, WEAPONSKILL_DESERT_EAGLE, PlayerInfo[playerid][pGunSkill][1]*10);
SetPlayerSkillLevel(playerid, WEAPONSKILL_SHOTGUN, PlayerInfo[playerid][pGunSkill][2]*10);
SetPlayerSkillLevel(playerid, WEAPONSKILL_MP5, PlayerInfo[playerid][pGunSkill][3]*10);
SetPlayerSkillLevel(playerid, WEAPONSKILL_AK47, PlayerInfo[playerid][pGunSkill][4]*10);
SetPlayerSkillLevel(playerid, WEAPONSKILL_M4, PlayerInfo[playerid][pGunSkill][5]*10);
return true;
}
//==============================================================================
stock OnPlayerAmmoChange(playerid, newammo, oldammo)
{
if(newammo < oldammo)
{
switch(GetPlayerWeapon(playerid))
{
case 24:
{
SetPVarInt(playerid, "SkillD",GetPVarInt(playerid,"SkillD") +1);
if(GetPVarInt(playerid,"SkillD") >= Ammo_DEAGLE && PlayerInfo[playerid][pGunSkill][1] < 100)
{
PlayerInfo[playerid][pGunSkill][1]++;
SetPVarInt(playerid, "SkillD",0);
}
}
case 23:
{
SetPVarInt(playerid, "SkillSD",GetPVarInt(playerid,"SkillSD") +1);
if(GetPVarInt(playerid,"SkillSD")>= Ammo_SDPISTOL && PlayerInfo[playerid][pGunSkill][0] < 100)
{
PlayerInfo[playerid][pGunSkill][0]++;
SetPVarInt(playerid, "SkillSD",0);
}
}
case 25:
{
SetPVarInt(playerid, "SkillShot",GetPVarInt(playerid,"SkillShot") +1);
if(GetPVarInt(playerid,"SkillShot") >= Ammo_SHOTGUN && PlayerInfo[playerid][pGunSkill][2] < 100)
{
PlayerInfo[playerid][pGunSkill][2]++;
SetPVarInt(playerid, "SkillShot",0);
}
}
case 29:
{
SetPVarInt(playerid, "SkillMP5",GetPVarInt(playerid,"SkillMP5") +1);
if(GetPVarInt(playerid,"SkillMP5") >= Ammo_MP5 && PlayerInfo[playerid][pGunSkill][3] < 100)
{
PlayerInfo[playerid][pGunSkill][3]++;
SetPVarInt(playerid, "SkillMP5",0);
}
}
case 30:
{
SetPVarInt(playerid, "SkillAk47",GetPVarInt(playerid,"SkillAk47") +1);
if(GetPVarInt(playerid,"SkillAk47") >= Ammo_AK47 && PlayerInfo[playerid][pGunSkill][4] < 100)
{
PlayerInfo[playerid][pGunSkill][4]++;
SetPVarInt(playerid, "SkillAk47",0);
}
}
case 31:
{
SetPVarInt(playerid, "SkillM4",GetPVarInt(playerid,"SkillM4") +1);
if(GetPVarInt(playerid,"SkillM4") >= Ammo_M4A1 && PlayerInfo[playerid][pGunSkill][5] < 100)
{
PlayerInfo[playerid][pGunSkill][5]++;
SetPVarInt(playerid, "SkillM4",0);
}
}
}
}
return true;
}
stock ProxDetectorNew(playerid,Float:Radi=10.0,color,text[])
{
new Float:pos[3];
GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i)) continue; //
if(IsPlayerInRangeOfPoint(i,Radi,pos[0],pos[1],pos[2]))
{
if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid) && GetPlayerInterior(playerid) == GetPlayerInterior(i))SendClientMessage(i,color,text);
}
}
}
PHP:
SetPlayerSkills(playerid);
PHP:
SetPVarInt(playerid, "NewPlayerAmmo", GetPlayerAmmo(playerid));
if(GetPVarInt(playerid, "NewPlayerAmmo") != GetPVarInt(playerid, "PlayerAmmo"))
{
OnPlayerAmmoChange(playerid, GetPVarInt(playerid, "NewPlayerAmmo"), GetPVarInt(playerid, "PlayerAmmo"));
SetPVarInt(playerid, "PlayerAmmo", GetPVarInt(playerid, "NewPlayerAmmo"));
}
iNewPlayerAmmo[playerid] = GetPlayerAmmo(playerid);
if(iNewPlayerAmmo[playerid] != iPlayerAmmo[playerid])
{
OnPlayerAmmoChange(playerid, iNewPlayerAmmo[playerid], iPlayerAmmo[playerid]);
iPlayerAmmo[playerid] = iNewPlayerAmmo[playerid];
}
PHP:
CMD:skill(playerid, params[])
{
new string[128],percent[2] = "%";
if(PlayerLogged[playerid] == 0) return true;
if(sscanf(params, "i", params[0])) return SendClientMessage(playerid, COLOR_WHITE, "Введите: /skill [id игрока]");
if(!IsPlayerConnected(params[0])) return SendClientMessage(playerid, COLOR_GREY, "Игрок в оффлайне");
if(!IsPlayerInRangeOfPlayer(8.0, playerid, params[0])) return SendClientMessage(playerid, COLOR_GREY, "Игрок слишком далеко!");
//=======
format(string,128,"SDPistol:\t%d%s\nD.Eagle:\t%d%s\nShotGun:\t%d%s\nMP5\t\t%d%s\nAK47:\t\t%d%s\nM4A1:\t\t%d%s",
PlayerInfo[playerid][pGunSkill][0],percent,PlayerInfo[playerid][pGunSkill][1],percent,PlayerInfo[playerid][pGunSkill][2],percent,PlayerInfo[playerid][pGunSkill][3],percent,PlayerInfo[playerid][pGunSkill][4],percent,PlayerInfo[playerid][pGunSkill][5],percent);
ShowPlayerDialog(params[0],D_NULL,DIALOG_STYLE_MSGBOX,"Навык владения оружием",string,"Закрыть","");
//=======
SendMes(playerid, COLOR_LIGHTBLUE, "Вы показали свои навыки владения оружием %s'у", sendername(params[0]));
SendMes(params[0], COLOR_LIGHTBLUE, "%s показал(а) вам свои навыки владения оружием",PN(playerid));
format(totalstring, 100, "%s показал(a) свои навыки владения оружием %s", PN(playerid), sendername(params[0]));
ProxDetectorNew(playerid, 30.0, COLOR_PURPLE, totalstring);
return true;
}
Будут какие то ошибки или вопросы пишите чем смогу помогу, система рабочая.
И еще не забудьте Загрузку/Cохранение скиллов сделать (pGunSkill)
