SHOW:
|
|
- or go back to the newest paste.
1 | #include "ScriptPCH.h" | |
2 | #include "Chat.h" | |
3 | ||
4 | class Freezeme_Command : public CommandScript | |
5 | { | |
6 | public: | |
7 | Freezeme_Command() : CommandScript("Freezeme_Command") {} | |
8 | ||
9 | ChatCommand* GetCommands() const | |
10 | - | { |
10 | + | |
11 | - | static ChatCommand Freezemecommandtable[] = |
11 | + | static ChatCommand Freezemecommandtable[] = |
12 | { | |
13 | { "freezeme", SEC_PLAYER, false, &HandleFreezemeCommand, "", NULL }, | |
14 | { NULL, 0, false, NULL, "", NULL } | |
15 | - | }; |
15 | + | }; |
16 | - | return Freezemecommandtable; |
16 | + | return Freezemecommandtable; |
17 | - | } |
17 | + | |
18 | ||
19 | static bool HandleFreezemeCommand(ChatHandler* handler, const char* args) | |
20 | { | |
21 | - | QueryResult Result = LoginDatabase.Query("SELECT id,vip FROM account WHERE vip= '1'"); |
21 | + | WorldSession* Session = handler->GetSession(); |
22 | Player* pPlayer = Session->GetPlayer(); | |
23 | QueryResult Result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE vip = 1 and id = %u", Session->GetAccountId()); | |
24 | - | Field * fields = NULL; |
24 | + | |
25 | - | Player* Executer = handler->GetSession()->GetPlayer(); |
25 | + | |
26 | - | do |
26 | + | Session->SendNotification("You aren't a V.I.P"); |
27 | - | { |
27 | + | |
28 | - | fields = Result->Fetch(); |
28 | + | |
29 | - | }while(Result->NextRow()); |
29 | + | if (pPlayer->HasAura(9454)) |
30 | - | if(fields[0].GetUInt32() == Executer->GetSession()->GetAccountId() && fields[1].GetUInt32() == 1 ) |
30 | + | pPlayer->RemoveAura(9454); |
31 | else | |
32 | pPlayer->AddAura(9454,pPlayer); | |
33 | - | if(Executer->GetSelectedPlayer() == Executer) |
33 | + | |
34 | } | |
35 | - | Executer->AddAura(9454,Executer); |
35 | + | |
36 | - | |
36 | + | |
37 | - | if (Executer->HasAura(9454)) |
37 | + | |
38 | { | |
39 | - | Executer->RemoveAura(9454); |
39 | + | new Freezeme_Command(); |
40 | } |