[pwn]
// GalaxY-Team #define REGISTER_DIALOG14 100
// enum pInfo
pColtSkill,
pSilenSkill,
pDesertSkill,
pShotgSkill,
pSmgSkill,
pAkSkill,
pM4Skill,
// OnPlayerConnect
PlayerInfo[playerid][pColtSkill] = 0;
PlayerInfo[playerid][pSilenSkill] = 0;
PlayerInfo[playerid][pDesertSkill] = 0;
PlayerInfo[playerid][pShotgSkill] = 0;
PlayerInfo[playerid][pSmgSkill] = 0;
PlayerInfo[playerid][pAkSkill] = 0;
PlayerInfo[playerid][pM4Skill] = 0;
// OnPlayerDeath
if(reason == 22) { if(PlayerInfo[killerid][pColtSkill] >= 0 && PlayerInfo[killerid][pColtSkill] <= 1000) { PlayerInfo[killerid][pColtSkill] += 2; SetPlayerSkills(killerid); } }
if(reason == 23) { if(PlayerInfo[killerid][pSilenSkill] >= 0 && PlayerInfo[killerid][pSilenSkill] <= 1000) { PlayerInfo[killerid][pSilenSkill] += 2; SetPlayerSkills(killerid); } }
if(reason == 24) { if(PlayerInfo[killerid][pDesertSkill] >= 0 && PlayerInfo[killerid][pDesertSkill] <= 1000) { PlayerInfo[killerid][pDesertSkill] += 2; SetPlayerSkills(killerid); } }
if(reason == 25) { if(PlayerInfo[killerid][pShotgSkill] >= 0 && PlayerInfo[killerid][pShotgSkill] <= 1000) { PlayerInfo[killerid][pShotgSkill] += 2; SetPlayerSkills(killerid); } }
if(reason == 29) { if(PlayerInfo[killerid][pSmgSkill] >= 0 && PlayerInfo[killerid][pSmgSkill] <= 1000) { PlayerInfo[killerid][pSmgSkill] += 2; SetPlayerSkills(killerid); } }
if(reason == 30) { if(PlayerInfo[killerid][pAkSkill] >= 0 && PlayerInfo[killerid][pAkSkill] <= 1000) { PlayerInfo[killerid][pAkSkill] += 2; SetPlayerSkills(killerid); } }
if(reason == 31) { if(PlayerInfo[killerid][pM4Skill] >= 0 && PlayerInfo[killerid][pM4Skill] <= 1000) { PlayerInfo[killerid][pM4Skill] += 2; SetPlayerSkills(killerid); } }
// OnPlayerRegister
format(var, 64, "PistolSkill=%d\n",PlayerInfo[playerid][pColtSkill]);fwrite(hFile, var);
format(var, 64, "SilencedSkill=%d\n",PlayerInfo[playerid][pSilenSkill]);fwrite(hFile, var);
format(var, 64, "DesertSkill=%d\n",PlayerInfo[playerid][pDesertSkill]);fwrite(hFile, var);
format(var, 64, "ShotgunSkill=%d\n",PlayerInfo[playerid][pShotgSkill]);fwrite(hFile, var);
format(var, 64, "SMGSkill=%d\n",PlayerInfo[playerid][pSmgSkill]);fwrite(hFile, var);
format(var, 64, "AK47Skill=%d\n",PlayerInfo[playerid][pAkSkill]);fwrite(hFile, var);
format(var, 64, "M4Skill=%d\n",PlayerInfo[playerid][pM4Skill]);fwrite(hFile, var);
// OnPlayerUpdate (В паблик сохранения короче)
format(var, 64, "PistolSkill=%d\n",PlayerInfo[playerid][pColtSkill]);fwrite(hFile, var);
format(var, 64, "SilencedSkill=%d\n",PlayerInfo[playerid][pSilenSkill]);fwrite(hFile, var);
format(var, 64, "DesertSkill=%d\n",PlayerInfo[playerid][pDesertSkill]);fwrite(hFile, var);
format(var, 64, "ShotgunSkill=%d\n",PlayerInfo[playerid][pShotgSkill]);fwrite(hFile, var);
format(var, 64, "SMGSkill=%d\n",PlayerInfo[playerid][pSmgSkill]);fwrite(hFile, var);
format(var, 64, "AK47Skill=%d\n",PlayerInfo[playerid][pAkSkill]);fwrite(hFile, var);
format(var, 64, "M4Skill=%d\n",PlayerInfo[playerid][pM4Skill]);fwrite(hFile, var);
// OnPlayerLogin
if( strcmp( key , "PistolSkill" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pColtSkill] = strval( val ); }
if( strcmp( key , "SilencedSkill" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSilenSkill] = strval( val ); }
if( strcmp( key , "DesertSkill" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDesertSkill] = strval( val ); }
if( strcmp( key , "ShotgunSkill" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pShotgSkill] = strval( val ); }
if( strcmp( key , "SmgSkill" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSmgSkill] = strval( val ); }
if( strcmp( key , "Ak47Skill" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAkSkill] = strval( val ); }
if( strcmp( key , "M4Skill" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pM4Skill] = strval( val ); }
// OnPlayerCommandText
if(strcmp(cmd, "/gunskill", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "Ты не вошел!");
new ptext[20], stext[20], dtext[20], shtext[20], smtext[20], sktext[20], s4text[20];
// Colt
if(PlayerInfo[playerid][pColtSkill] >= 0 && PlayerInfo[playerid][pColtSkill] <= 199) ptext = "1 Уровень";
else if(PlayerInfo[playerid][pColtSkill] >= 200 && PlayerInfo[playerid][pColtSkill] <= 399) ptext = "2 Уровень";
else if(PlayerInfo[playerid][pColtSkill] >= 400 && PlayerInfo[playerid][pColtSkill] <= 599) ptext = "3 Уровень";
else if(PlayerInfo[playerid][pColtSkill] >= 600 && PlayerInfo[playerid][pColtSkill] <= 799) ptext = "4 Уровень";
else if(PlayerInfo[playerid][pColtSkill] >= 800) ptext = "5 Уровень";
// SDPistol
if(PlayerInfo[playerid][pSilenSkill] >= 0 && PlayerInfo[playerid][pSilenSkill] <= 199) stext = "1 Уровень";
else if(PlayerInfo[playerid][pSilenSkill] >= 200 && PlayerInfo[playerid][pSilenSkill] <= 399) stext = "2 Уровень";
else if(PlayerInfo[playerid][pSilenSkill] >= 400 && PlayerInfo[playerid][pSilenSkill] <= 599) stext = "3 Уровень";
else if(PlayerInfo[playerid][pSilenSkill] >= 600 && PlayerInfo[playerid][pSilenSkill] <= 799) stext = "4 Уровень";
else if(PlayerInfo[playerid][pSilenSkill] >= 800) stext = "5 Уровень";
// Deagle
if(PlayerInfo[playerid][pDesertSkill] >= 0 && PlayerInfo[playerid][pDesertSkill] <= 199) dtext = "1 Уровень";
else if(PlayerInfo[playerid][pDesertSkill] >= 200 && PlayerInfo[playerid][pDesertSkill] <= 399) dtext = "2 Уровень";
else if(PlayerInfo[playerid][pDesertSkill] >= 400 && PlayerInfo[playerid][pDesertSkill] <= 599) dtext = "3 Уровень";
else if(PlayerInfo[playerid][pDesertSkill] >= 600 && PlayerInfo[playerid][pDesertSkill] <= 799) dtext = "4 Уровень";
else if(PlayerInfo[playerid][pDesertSkill] >= 800) dtext = "5 Уровень";
// Shotgun
if(PlayerInfo[playerid][pShotgSkill] >= 0 && PlayerInfo[playerid][pShotgSkill] <= 199) shtext = "1 Уровень";
else if(PlayerInfo[playerid][pShotgSkill] >= 200 && PlayerInfo[playerid][pShotgSkill] <= 399) shtext = "2 Уровень";
else if(PlayerInfo[playerid][pShotgSkill] >= 400 && PlayerInfo[playerid][pShotgSkill] <= 599) shtext = "3 Уровень";
else if(PlayerInfo[playerid][pShotgSkill] >= 600 && PlayerInfo[playerid][pShotgSkill] <= 799) shtext = "4 Уровень";
else if(PlayerInfo[playerid][pShotgSkill] >= 800) shtext = "5 Уровень";
// MP5
if(PlayerInfo[playerid][pSmgSkill] >= 0 && PlayerInfo[playerid][pSmgSkill] <= 199) smtext = "1 Уровень";
else if(PlayerInfo[playerid][pSmgSkill] >= 200 && PlayerInfo[playerid][pSmgSkill] <= 399) smtext = "2 Уровень";
else if(PlayerInfo[playerid][pSmgSkill] >= 400 && PlayerInfo[playerid][pSmgSkill] <= 599) smtext = "3 Уровень";
else if(PlayerInfo[playerid][pSmgSkill] >= 600 && PlayerInfo[playerid][pSmgSkill] <= 799) smtext = "4 Уровень";
else if(PlayerInfo[playerid][pSmgSkill] >= 800) smtext = "5 Уровень";
// AK-47
if(PlayerInfo[playerid][pAkSkill] >= 0 && PlayerInfo[playerid][pAkSkill] <= 199) sktext = "1 Уровень";
else if(PlayerInfo[playerid][pAkSkill] >= 200 && PlayerInfo[playerid][pAkSkill] <= 399) sktext = "2 Уровень";
else if(PlayerInfo[playerid][pAkSkill] >= 400 && PlayerInfo[playerid][pAkSkill] <= 599) sktext = "3 Уровень";
else if(PlayerInfo[playerid][pAkSkill] >= 600 && PlayerInfo[playerid][pAkSkill] <= 799) sktext = "4 Уровень";
else if(PlayerInfo[playerid][pAkSkill] >= 800) sktext = "5 Уровень"; }
// M4
if(PlayerInfo[playerid][pM4Skill] >= 0 && PlayerInfo[playerid][pM4Skill] <= 199) s4text = "1 Уровень";
else if(PlayerInfo[playerid][pM4Skill] >= 200 && PlayerInfo[playerid][pM4Skill] <= 399) s4text = "2 Уровень";
else if(PlayerInfo[playerid][pM4Skill] >= 400 && PlayerInfo[playerid][pM4Skill] <= 599) s4text = "3 Уровень";
else if(PlayerInfo[playerid][pM4Skill] >= 600 && PlayerInfo[playerid][pM4Skill] <= 799) s4text = "4 Уровень";
else if(PlayerInfo[playerid][pM4Skill] >= 800) s4text = "5 Уровень";
format(string, sizeof(string), "Colt Skill:[%s]\nSilenced Skill:[%s]\nDeagle Skill:[%s]\nShotgun Skill:[%s]\nMP5 Skill:[%s]\nM4 Skill:[%s]\nAK-47 Skill:[%s]", ptext, stext, dtext, shtext, smtext, sktext, s4text);
ShowPlayerDialog(playerid, REGISTER_DIALOG14, DIALOG_STYLE_MSGBOX, "Gun's Skill", string, "ENTER", "CANCEL");
}
return 1;
}
if(strcmp(cmd, "/setweapskill", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "Используй: /setweapskill [playerid/PartOfName] [weapon] [amount]");
SendClientMessage(playerid, COLOR_GREY, "| 1 Colt45 | 2 Silenced | 3 Deagle | 4 Shotgun");
SendClientMessage(playerid, COLOR_GREY, "| 5 MP5 | 6 AK47 | 7 M4");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "Используй: /setweapskill [playerid/PartOfName] [weapon] [amount]");
SendClientMessage(playerid, COLOR_GREY, "| 1 Colt45 | 2 Silenced | 3 Deagle | 4 Shotgun");
SendClientMessage(playerid, COLOR_GREY, "| 5 MP5 | 6 AK47 | 7 M4");
return 1;
}
new weapon;
weapon = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "Используй: /setweapskill [playerid/PartOfName] [weapon] [amount]");
SendClientMessage(playerid, COLOR_GREY, "| 1 Colt45 | 2 Silenced | 3 Deagle | 4 Shotgun");
SendClientMessage(playerid, COLOR_GREY, "| 5 MP5 | 6 AK47 | 7 M4");
return 1;
}
new amount;
amount = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 3)
{
switch (weapon)
{
case 1:
{
if(amount < 0 || amount > 1000) return SendClientMessage(playerid, COLOR_GREY, "Skill не больше 1000, и не меньше 0!");
PlayerInfo[giveplayerid][pColtSkill] = amount;
SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, amount);
format(string, sizeof(string), "Colt45 Skill у игрока теперь %d.", amount);
SendClientMessage(playerid, COLOR_GRAD1, string);
SetPlayerSkills(giveplayerid);
}
case 2:
{
if(amount < 0 || amount > 1000) return SendClientMessage(playerid, COLOR_GREY, "Skill не больше 1000, и не меньше 0!");
PlayerInfo[giveplayerid][pSilenSkill] = amount;
SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, amount);
format(string, sizeof(string), "Silenced Skill у игрока теперь %d.", amount);
SendClientMessage(playerid, COLOR_GRAD1, string);
SetPlayerSkills(giveplayerid);
}
case 3:
{
if(amount < 0 || amount > 1000) return SendClientMessage(playerid, COLOR_GREY, "Skill не больше 1000, и не меньше 0!");
PlayerInfo[giveplayerid][pDesertSkill] = amount;
SetPlayerSkillLevel(playerid, WEAPONSKILL_DESERT_EAGLE, amount);
format(string, sizeof(string), "Deagle Skill у игрока теперь %d.", amount);
SendClientMessage(playerid, COLOR_GRAD1, string);
SetPlayerSkills(giveplayerid);
}
case 4:
{
if(amount < 0 || amount > 1000) return SendClientMessage(playerid, COLOR_GREY, "Skill не больше 1000, и не меньше 0!");
PlayerInfo[giveplayerid][pShotgSkill] = amount;
SetPlayerSkillLevel(playerid, WEAPONSKILL_SHOTGUN, amount);
format(string, sizeof(string), "Shotgun Skill у игрока теперь %d.", amount);
SendClientMessage(playerid, COLOR_GRAD1, string);
SetPlayerSkills(giveplayerid);
}
case 5:
{
if(amount < 0 || amount > 1000) return SendClientMessage(playerid, COLOR_GREY, "Skill не больше 1000, и не меньше 0!");
PlayerInfo[giveplayerid][pSmgSkill] = amount;
SetPlayerSkillLevel(playerid, WEAPONSKILL_MP5, amount);
format(string, sizeof(string), "MP5 Skill у игрока теперь %d.", amount);
SendClientMessage(playerid, COLOR_GRAD1, string);
SetPlayerSkills(giveplayerid);
}
case 6:
{
if(amount < 0 || amount > 1000) return SendClientMessage(playerid, COLOR_GREY, "Skill не больше 1000, и не меньше 0!");
PlayerInfo[giveplayerid][pAkSkill] = amount;
SetPlayerSkillLevel(playerid, WEAPONSKILL_AK47, amount);
format(string, sizeof(string), "AK47 Skill у игрока теперь %d.", amount);
SendClientMessage(playerid, COLOR_GRAD1, string);
SetPlayerSkills(giveplayerid);
}
case 7:
{
if(amount < 0 || amount > 1000) return SendClientMessage(playerid, COLOR_GREY, "Skill не больше 1000, и не меньше 0!");
PlayerInfo[giveplayerid][pM4Skill] = amount;
SetPlayerSkillLevel(playerid, WEAPONSKILL_M4, amount);
format(string, sizeof(string), "M4A4 Skill у игрока теперь %d.", amount);
SendClientMessage(playerid, COLOR_GRAD1, string);
SetPlayerSkills(giveplayerid);
}
default: SendClientMessage(playerid, COLOR_GRAD1, "Невозможное значение!");
}
}
else SendClientMessage(playerid, COLOR_GRAD1, "Ты не можешь использовать эту команду!");
}
}
}
return 1;
}
// SetPlayerSkills
forward SetPlayerSkills(playerid);
public SetPlayerSkills(playerid)
{
SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, PlayerInfo[playerid][pColtSkill]);
SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, PlayerInfo[playerid][pSilenSkill]);
SetPlayerSkillLevel(playerid, WEAPONSKILL_DESERT_EAGLE, PlayerInfo[playerid][pDesertSkill]);
SetPlayerSkillLevel(playerid, WEAPONSKILL_SHOTGUN, PlayerInfo[playerid][pShotgSkill]);
SetPlayerSkillLevel(playerid, WEAPONSKILL_MP5, PlayerInfo[playerid][pSmgSkill]);
SetPlayerSkillLevel(playerid, WEAPONSKILL_AK47, PlayerInfo[playerid][pAkSkill]);
SetPlayerSkillLevel(playerid, WEAPONSKILL_M4, PlayerInfo[playerid][pM4Skill]);
return 1;
}
// OnPlayerLogin
SetPlayerSkills(playerid);
// GalaxY-Team
[/pwn]
Удачи