AlexPPPP | Дата: Суббота, 09.08.2014, 17:01 | Сообщение # 1 |
.::Offline::.
Гангстер
Сообщений: 179
[ 21 ]
Награды: 19
Статус
отсутствует
| Ко всем new добавляем
Код new bool:Offer[MAX_PLAYERS] = false; В public OnPlayerCommandText(playerid, cmdtext[])
Код if(strcmp(cmd, "/givemygun", true) == 0) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) return SendClientMessage(playerid,-1,"Введите: /givemygun [ID]"); new ID = strval(tmp); if(ID == playerid) return SendClientMessage(playerid,-1,"Вы не можете передать оружие самому себе!"); if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,-1,"Игрок не найден!"); if(GetPlayerWeapon(playerid) == 0) return SendClientMessage(playerid,-1,"У вас нет оружия в руках!"); new Float:pos[3]; GetPlayerPos(ID, pos[0], pos[1], pos[2]); if(!IsPlayerInRangeOfPoint(playerid, 1.2, pos[0], pos[1], pos[2])) return SendClientMessage(playerid,-1,"Вы далеко от этого игрока!"); new nickplayer1[MAX_PLAYER_NAME], nickplayer2[MAX_PLAYER_NAME], sg[90]; GetPlayerName(playerid, nickplayer1, sizeof(nickplayer1)); GetPlayerName(ID, nickplayer2, sizeof(nickplayer2)); SetPVarInt(ID, "Gun", GetPlayerWeapon(playerid)); SetPVarInt(ID, "Ammo", GetPlayerAmmo(playerid)); SetPVarInt(ID, "IDplayer", playerid); SetPVarString(ID, "Nick1", nickplayer1); SetPVarString(ID, "Nick2", nickplayer2); format(sg, 70, "Вы предложили %s оружие которое у вас в руках.", nickplayer2); SendClientMessage(playerid, -1, sg); format(sg, 90, "%s предлагает вам оружие. Клавиша: Y - согласиться, N - отказаться.", nickplayer1); SendClientMessage(ID, -1, sg); Offer[ID] = true; return 1; } В public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
Код if(newkeys == KEY_YES) { if(Offer[playerid] == true) { new getnick1[MAX_PLAYER_NAME], getnick2[MAX_PLAYER_NAME], sg[45]; GetPVarString(playerid, "Nick1", getnick1, sizeof(getnick1)); GetPVarString(playerid, "Nick2", getnick2, sizeof(getnick2)); format(sg, sizeof(sg), "Вы передали оружие %s", getnick2); SendClientMessage(GetPVarInt(playerid, "IDplayer"), -1, sg); format(sg, sizeof(sg), "Вы взяли оружие у %s", getnick1); SendClientMessage(playerid, -1, sg); RemovePlayerWeapon(GetPVarInt(playerid, "IDplayer"), GetPVarInt(playerid, "Gun")); GivePlayerWeapon(playerid, GetPVarInt(playerid, "Gun"), GetPVarInt(playerid, "Ammo")); DeletePVar(playerid, "Gun"); DeletePVar(playerid, "Ammo"); DeletePVar(playerid, "IDplayer"); DeletePVar(playerid, "Nick1"); DeletePVar(playerid, "Nick2"); Offer[playerid] = false; return 1; } } if(newkeys == KEY_NO) { if(Offer[playerid] == true) { new getnick1[MAX_PLAYER_NAME], getnick2[MAX_PLAYER_NAME], sg[60]; GetPVarString(playerid, "Nick1", getnick1, sizeof(getnick1)); GetPVarString(playerid, "Nick2", getnick2, sizeof(getnick2)); format(sg, sizeof(sg), "%s отказался принимать ваше оружие", getnick2); SendClientMessage(GetPVarInt(playerid, "IDplayer"), -1, sg); format(sg, sizeof(sg), "Вы отказались принимать оружие от %s", getnick1); SendClientMessage(playerid, -1, sg); DeletePVar(playerid, "Gun"); DeletePVar(playerid, "Ammo"); DeletePVar(playerid, "IDplayer"); DeletePVar(playerid, "Nick1"); DeletePVar(playerid, "Nick2"); Offer[playerid] = false; return 1; } } Если у вас ошибка error 017: undefined symbol "RemovePlayerWeapon" то в конец мода: Код RemovePlayerWeapon(playerid, weaponid) { new plyWeapons[12] = 0; new plyAmmo[12] = 0; for(new slot = 0; slot != 12; slot++) { new wep, ammo; GetPlayerWeaponData(playerid, slot, wep, ammo); if(wep != weaponid && ammo != 0) { GetPlayerWeaponData(playerid, slot, plyWeapons[slot], plyAmmo[slot]); } } ResetPlayerWeapons(playerid); for(new slot = 0; slot != 12; slot++) { if(plyAmmo[slot] != 0) { GivePlayerWeapon(playerid, plyWeapons[slot], plyAmmo[slot]); } } return 1; }
Релизы [GM] Far EastRolePlay[Repack LessGlobal] S.T.A.L.K.E.R New.pwn 45% ( мод заливать не буду )
Сообщение отредактировал
AlexPPPP - Суббота, 09.08.2014, 17:03 |
|
| |