Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- // Advanced Weapons by O.K.Style™
- new AWName[] = {"гаечного ключа", "монтировки", "молотка", "фонарика", "электрошокера", "отвёртки", "граблей", "бензочлена", "басс-гитары", "флай-гитары", "варлок-гитары", "трости"};
- new AWDamage[12] = {25, 30, 35, 10, 30, 35, 25, 5, 15, 15, 15, 10};
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[256], idx;
- cmd = strtok(cmdtext, idx);
- if(strcmp(cmd, "/aw", true) == 0)
- {
- new tmp[30];
- tmp = strtok(cmdtext, idx);
- if(strlen(tmp) < 1) return SendClientMessage(playerid, -1, "{BCBCBC}Синтаксис: /aw [awid]");
- new aw = strval(tmp);
- if(aw < 1 || aw > 10) return SendClientMessage(playerid, -1, "{FDE39D}Данный ID дополнительного оружия не существует.");
- new slot = GetPVarInt(playerid, "AWSlot");
- if(slot > 0) RemovePlayerAttachedObject(playerid, slot);
- slot = -1;
- for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++)
- {
- if(IsPlayerAttachedObjectSlotUsed(playerid, i)) continue;
- slot = i;
- SetPVarInt(playerid, "AWSlot", slot);
- break;
- }
- if(slot == -1) return SendClientMessage(playerid, -1, "{FDE39D}У Вашего персонажа нет свободных слотов для аттача.");
- SetPVarInt(playerid, "AdvWeap", aw);
- switch(aw)
- {
- case 1: SetPlayerAttachedObject(playerid, slot, 18633, 6, 0.074999, 0.023999, 0.053999, 104.199981, -91.499992, 1.500003, 1.000000, 1.000000, 1.000000);
- case 2: SetPlayerAttachedObject(playerid, slot, 18634, 6, 0.054000, 0.013999, -0.087999, -94.399963, -25.899974, 175.799911, 1.000000, 1.000000, 1.000000);
- case 3: SetPlayerAttachedObject(playerid, slot, 18635, 6, -0.004000, -0.008000, -0.073000, 3.299994, 0.000000, -6.100000, 1.000000, 1.000000, 1.000000);
- case 4: SetPlayerAttachedObject(playerid, slot, 18641, 6, 0.057999, 0.023000, 0.050000, 0.000000, 167.599990, 0.000000, 1.000000, 1.000000, 1.000000);
- case 5: SetPlayerAttachedObject(playerid, slot, 18642, 6, 0.051000, 0.009000, 0.041999, -172.099929, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000);
- case 6: SetPlayerAttachedObject(playerid, slot, 18644, 6, 0.072999, 0.007999, -0.006999, 178.700027, 0.000000, -3.599997, 1.000000, 1.000000, 1.000000);
- case 7: SetPlayerAttachedObject(playerid, slot, 18890, 6, -0.021999, 0.030000, -0.243999, -174.999984, -0.199999, -92.600028, 1.000000, 1.000000, 1.000000);
- case 8: SetPlayerAttachedObject(playerid, slot, 19086, 6, 0.000000, 0.007999, 0.023000, 1.499997, -93.900032, 0.000000, 1.000000, 1.000000, 1.000000);
- case 9: SetPlayerAttachedObject(playerid, slot, 19317, 6, 0.073999, 0.030000, 0.150000, -177.400024, -4.500000, -4.199998, 1.000000, 1.000000, 1.000000);
- case 10: SetPlayerAttachedObject(playerid, slot, 19318, 6, 0.054000, 0.011999, 0.197000, 0.000000, 177.300048, -171.399917, 1.000000, 1.000000, 1.000000);
- case 11: SetPlayerAttachedObject(playerid, slot, 19319, 6, 0.049999, 0.008000, 0.240000, -176.999954, 0.000000, -12.299943, 1.000000, 1.000000, 1.000000);
- case 12: SetPlayerAttachedObject(playerid, slot, 19348, 6, 0.050999, 0.043000, 0.353999, 175.300033, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000);
- default: return 1;
- }
- new string[128];
- format(string, sizeof(string), "{FDE39D}Вы стали обладателем %s.", AWName[aw]);
- SendClientMessage(playerid, -1, string);
- return 1;
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- #pragma unused reason
- if(killerid == INVALID_PLAYER_ID) return 1;
- new aw = GetPVarInt(killerid, "AdvWeap");
- if(aw != 0)
- {
- new string[128], PlayerName[MAX_PLAYER_NAME], TargetName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, TargetName, sizeof(TargetName));
- GetPlayerName(killerid, PlayerName, sizeof(PlayerName));
- format(string, sizeof(string), "{FFFFFF}Игрок {FDE39D}%s {FFFFFF}был убит игроком {FDE39D}%s {FFFFFF}с помощью {FDE39D}%s{FFFFFF}.", TargetName, PlayerName, AWName[aw]);
- SendClientMessageToAll(-1, string);
- return 1;
- }
- return 1;
- }
- public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
- {
- if(issuerid != INVALID_PLAYER_ID)
- {
- if(weaponid == 0)
- {
- new aw = GetPVarInt(issuerid, "AdvWeap");
- new Float:hp;
- GetPlayerHealth(playerid, hp);
- SetPlayerHealth(playerid, hp + amount - AWDamage[aw]);
- }
- }
- return 1;
- }
- stock strtok(const string[], &index)
- {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' ')) index++;
- new offset = index, result[20];
- while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement