Now we're warning the player when they want to build another (insert structure here)
This commit is contained in:
parent
36e2dc43b6
commit
54d2fe4e0b
4 changed files with 60 additions and 0 deletions
|
@ -17,3 +17,19 @@
|
|||
#include "gamerules.h"
|
||||
#include "../../../valve/src/server/items.h"
|
||||
#include "../../../valve/src/server/flashlight.h"
|
||||
|
||||
/* returns if a player already has a teleporter/exit built */
|
||||
bool
|
||||
TFC_ExistsForPlayer(entity pl, string cname)
|
||||
{
|
||||
/* loop through all exits */
|
||||
for (entity e = world; (e = find(e, ::classname, cname));) {
|
||||
/* if it's not places by our owner... */
|
||||
if (e.real_owner != pl)
|
||||
continue;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -75,6 +75,17 @@ CSEv_TFC_BuildDispenser_(void)
|
|||
return;
|
||||
}
|
||||
|
||||
/* can't build in the air */
|
||||
if (!(pl.flags & FL_ONGROUND)) {
|
||||
env_message_single(pl, "#Build_air");
|
||||
return;
|
||||
}
|
||||
|
||||
if (TFC_ExistsForPlayer(pl, "TFCDispenser")) {
|
||||
env_message_single(pl, "#Build_onedispenser");
|
||||
return;
|
||||
}
|
||||
|
||||
pl.m_iAmmoCells -= TFC_DISPENSER_COST;
|
||||
|
||||
/* deploy */
|
||||
|
|
|
@ -85,6 +85,17 @@ CSEv_TFC_BuildSentry_(void)
|
|||
return;
|
||||
}
|
||||
|
||||
/* can't build in the air */
|
||||
if (!(pl.flags & FL_ONGROUND)) {
|
||||
env_message_single(pl, "#Build_air");
|
||||
return;
|
||||
}
|
||||
|
||||
if (TFC_ExistsForPlayer(pl, "TFCSentry")) {
|
||||
env_message_single(pl, "#Build_onesentry");
|
||||
return;
|
||||
}
|
||||
|
||||
pl.m_iAmmoCells -= TFC_SENTRY_COST;
|
||||
|
||||
/* deploy */
|
||||
|
|
|
@ -141,6 +141,17 @@ CSEv_TFC_BuildTele_(void)
|
|||
return;
|
||||
}
|
||||
|
||||
/* can't build in the air */
|
||||
if (!(pl.flags & FL_ONGROUND)) {
|
||||
env_message_single(pl, "#Build_air");
|
||||
return;
|
||||
}
|
||||
|
||||
if (TFC_ExistsForPlayer(pl, "TFCTeleport")) {
|
||||
env_message_single(pl, "You can only have one teleporter.");
|
||||
return;
|
||||
}
|
||||
|
||||
pl.m_iAmmoCells -= TFC_TELEPORTER_COST;
|
||||
|
||||
/* deploy */
|
||||
|
@ -164,6 +175,17 @@ CSEv_TFC_BuildTeleExit_(void)
|
|||
return;
|
||||
}
|
||||
|
||||
/* can't build in the air */
|
||||
if (!(pl.flags & FL_ONGROUND)) {
|
||||
env_message_single(pl, "#Build_air");
|
||||
return;
|
||||
}
|
||||
|
||||
if (TFC_ExistsForPlayer(pl, "TFCTeleportExit")) {
|
||||
env_message_single(pl, "You can only have one teleporter exit.");
|
||||
return;
|
||||
}
|
||||
|
||||
pl.m_iAmmoCells -= TFC_TELEPORTER_COST;
|
||||
|
||||
/* deploy */
|
||||
|
|
Loading…
Reference in a new issue