SHOW:
|
|
- or go back to the newest paste.
1 | - | #include <cstdlib> |
1 | + | |
2 | - | #include <iostream> |
2 | + | Player* player = GetSession()->GetPlayer(); |
3 | Unit* target = getSelectedUnit(); | |
4 | - | using namespace std; |
4 | + | |
5 | if (!target || !GetSession()->GetPlayer()->GetSelection()) | |
6 | - | uint base, power, result; |
6 | + | { |
7 | SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); | |
8 | - | uint exponent(uint b, uint e) { |
8 | + | SetSentErrorMessage(true); |
9 | - | if(e == 1) { |
9 | + | return false; |
10 | - | return b; |
10 | + | |
11 | - | } else { |
11 | + | |
12 | - | return b * exponent(b, (e - 1)); |
12 | + | if (target->GetTypeId() == TYPEID_PLAYER && player->GetSession()->GetSecurity() < 9) |
13 | { | |
14 | - | } |
14 | + | if (HasLowerSecurity((Player*)target, 0, false)) |
15 | return false; | |
16 | - | int main() { |
16 | + | |
17 | - | cout << "Welcome to the Exponent Calculator." << endl; |
17 | + | if(!*args) |
18 | - | cout << "Please put a base: "; |
18 | + | { |
19 | - | cin >> base; |
19 | + | PSendSysMessage("You must enter a reason to kill the player."); |
20 | - | cout << "Please put an exponent : "; |
20 | + | SetSentErrorMessage(true); |
21 | - | cin >> power; |
21 | + | return false; |
22 | - | result = exponent(base, power); |
22 | + | } |
23 | - | cout << "The result of " << base << "^" << power << " is: " << result; |
23 | + | |
24 | - | |
24 | + | if (target->GetMap()->IsBattlegroundOrArena()) |
25 | - | return 0; |
25 | + | { |
26 | - | } |
26 | + | SendSysMessage("You can not kill players in a battleground or arena."); |
27 | SetSentErrorMessage(true); | |
28 | return false; | |
29 | } | |
30 | ||
31 | std::string diereason = args; | |
32 | ChatHandler((Player*)target).PSendSysMessage("GM: |cffFF0000%s|cffFFFF05 has killed you with the kill command. The reason was: |cffFF0000%s|cffFFFF05.|r", player->GetName(), diereason.c_str()); | |
33 | } | |
34 | ||
35 | if (target->isAlive()) | |
36 | { | |
37 | if (sWorld->getBoolConfig(CONFIG_DIE_COMMAND_MODE)) | |
38 | player->Kill(target); | |
39 | else | |
40 | player->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); | |
41 | } | |
42 | ||
43 | return true; |