I would like to know how to add an extra name to this if statement. I tried a lot of things, but they didn't seem to work. This is my code at the moment:
string name = reinterpret_cast<const char*>(this->Playerptr + 32);//
if (this->beginWith("/maxstatsz") && this->GetAdmin() >= 8 && !name.compare("jack")) {//
this->forward = false; //
this->Buff(46, (30 * 60), 1000);//
this->Buff(47, (30 * 60), 1000);//
this->Buff(48, (30 * 60), 1000);
this->Buff(49, (30 * 60), 1000);
this->Buff(12, (30 * 60), 1000);
Server::CPlayer::Write((void*)this->Playerptr, 60, "ss", "Server", "#Enabled Buffs!");//
}
This command will now work only for a player with adminrights >= 8 with the name jack. I tested it and it works fine.
But now I want to add also another player name to it that would be able to use this command too.
I added this under Server::CPlayer with the Buffs under it, of course, but this didn't work:
else if (this->beginWith("/maxstatsz") && this->GetAdmin() >= 8 && !name.compare("hero")) {//
etc.
This didnt work too
if (this->beginWith("/maxstatsz") && this->GetAdmin() >= 8 && !name.compare("jack") || this->beginWith("/maxstatsz") && this->GetAdmin() >= 8 && !name.compare("john")) {
I don't know what I'm doing wrong. Maybe I need to use OR instead of an else if statement?
I hope someone can help me out.
Aucun commentaire:
Enregistrer un commentaire