alternativ4ik
Новичок
Помогите с командой, выдает лицензии самому себе когда указываешь другой айди
PHP:
CMD:givelicense(playerid, params[])
{
new id;
if(PTEMP[playerid][pMember] != 11) return SendClientMessage(playerid,COLOR_GREY,"Отказано в доступе!");
if(!GetPVarInt(playerid,"Fraction_Duty")) return SCM(playerid,COLOR_GRAD1, "Вам нужно начать рабочий день в автошколе!");
if(sscanf(params,"u",id)) return SendClientMessage(playerid, COLOR_GREY, "Используй: /givelicense [id]");
if(!ProxDetectorS(10,playerid,id)) return SendClientMessage(playerid, COLOR_GREY, "[Ошибка] {FFFFFF}Вы далеко от игрока.");
if(id == playerid) return SendClientMessage(playerid,COLOR_GREY,"[Ошибка] {FFFFFF}Вы не можете выдать лицензии самому себе!");
PanelPlayerID[playerid] = id;
PanelPlayerID[id] = playerid;
new rank = PTEMP[playerid][pRank];
if(rank >= 2)
{
new listitems[] = " [0] Водительские права\n [1] Лицензия на полёты [2] Лицензия на рыболовлю\n [3] Лицензия на вождение водного транспорта\n [4] Лицензия на оружие\n [5] Лицензия на бизнес\n";
ShowPlayerDialogEx(playerid, 1448, DIALOG_STYLE_LIST, "Выдача лицензий", listitems, "Выбрать", "Отмена");
SetPVarInt(PanelPlayerID[id],"PlayerSell",playerid);
}
return true;
case 1448:
{
new giveplayer[MAX_PLAYER_NAME];
if(!response) return DeletePVar(giveplayer[playerid],"PlayerSell");
switch(listitem)
{
case 0:
{
if(PTEMP[giveplayer[playerid]][pCarLic] == 1) return SCM(playerid, COLOR_GRAD1, "У данного игрока уже есть вод.права!");
if(PTEMP[giveplayer[playerid]][pLevel] <= 2) SetPVarInt(giveplayer[playerid], "MoneyLicenses",500);
else if(PTEMP[giveplayer[playerid]][pLevel] <= 5) SetPVarInt(giveplayer[playerid], "MoneyLicenses",5000);
else if(PTEMP[giveplayer[playerid]][pLevel] <= 15) SetPVarInt(giveplayer[playerid], "MoneyLicenses",10000);
else SetPVarInt(giveplayer[playerid], "MoneyLicenses",30000);
SetPVarInt(giveplayer[playerid], "Licenses",1);
format(string,256,"Инструктор %s предлагает купить вам права за %i вирт\nВы согласны?",PTEMP[playerid][pName],GetPVarInt(giveplayer[playerid], "MoneyLicenses"));
ShowPlayerDialogEx(giveplayer[playerid], 1448, DIALOG_STYLE_LIST, "Выдача лицензий",string, "Купить;", "Отмена");
return true;
}
}
}
}
