Raised This Month: $ Target: $400
 0% 

[ANY] Map Zones (with forwards)


Post New Thread Reply   
 
Thread Tools Display Modes
Root_
Veteran Member
Join Date: Jan 2012
Location: ryssland
Old 02-10-2014 , 18:19   Re: [ANY] Map Zones (with forwards)
Reply With Quote #71

You can call them whatever you want for unlimited amount of times, so God1, God2 and etc is easier to do than remaking core plugin or creating new forwards. If you gonna keep using 'god' names with appropriate 'punishments', StrContains would save your time.
__________________


dodsplugins.com - Plugins and Resources for Day of Defeat
http://twitch.tv/zadroot
Root_ is offline
captaindeterprimary
AlliedModders Donor
Join Date: Sep 2012
Old 02-10-2014 , 19:50   Re: [ANY] Map Zones (with forwards)
Reply With Quote #72

So if I would want to do a area to do BlueSpawnGodNoTargetLowGrav would I just do

Spoiler


And that would be redundant printing PrintToChat over and over, how would I go about making it not so. In php I would just do
Spoiler

How would this be wrote up in sm?
__________________
Last edited by ; Today at 08:20 AM. Reason: Get rid of s
captaindeterprimary is offline
Root_
Veteran Member
Join Date: Jan 2012
Location: ryssland
Old 02-11-2014 , 00:39   Re: [ANY] Map Zones (with forwards)
Reply With Quote #73

Code:
public Action:OnEnteredProtectedZone(zone, client, const String:prefix[]) {     static Handle:ShowZones   = INVALID_HANDLE;     if (!ShowZones) ShowZones = FindConVar("sm_zones_show_messages");     if (1 <= client <= MaxClients)     {         decl String:m_iName[MAX_NAME_LENGTH*2];         GetEntPropString(zone, Prop_Data, "m_iName", m_iName, sizeof(m_iName));         // Dont skip the first 8 characters due to StrContains         if (StrContains(m_iName, "god", false) != -1)         {             // enable godmode             ServerCommand("sm_god #%i 1", GetClientUserId(client));             if (GetConVarBool(ShowZones))             {                 PrintToChat(client, "%sYou have entered \"%s\" zone, god mode enabled!", prefix, m_iName[8]);             }         }         else if (StrContains(m_iName, "lowgrav", false) != -1)         {             // low gravity stuff             SetEntityGravity(client, 0.5);             if (GetConVarBool(ShowZones))             {                 PrintToChat(client, "%sYou have entered \"%s\" zone, set low gravity for you.", prefix, m_iName[8]);             }         }         } } public Action:OnLeftProtectedZone(zone, client, const String:prefix[]) {     static Handle:ShowZones   = INVALID_HANDLE;     if (!ShowZones) ShowZones = FindConVar("sm_zones_show_messages");     if (1 <= client <= MaxClients)     {         decl String:m_iName[MAX_NAME_LENGTH*2];         GetEntPropString(zone, Prop_Data, "m_iName", m_iName, sizeof(m_iName));         // When player leaves 'god' zone, reset god         if (StrContains(m_iName, "god", false) != -1)         {             ServerCommand("sm_god #%i 0", GetClientUserId(client));             if (GetConVarBool(ShowZones))             {                 PrintToChat(client, "%sYou have left \"%s\" zone, god mode disabled!", prefix, m_iName[8]);             }         }         else if (StrContains(m_iName, "lowgrav", false) != -1)         {             // Set default gravity for player             SetEntityGravity(client, 1.0);             if (GetConVarBool(ShowZones))             {                 PrintToChat(client, "%sYou have left \"%s\" zone, original gravity returned.", prefix, m_iName[8]);             }         }         } }
__________________


dodsplugins.com - Plugins and Resources for Day of Defeat
http://twitch.tv/zadroot

Last edited by Root_; 02-11-2014 at 04:21.
Root_ is offline
captaindeterprimary
AlliedModders Donor
Join Date: Sep 2012
Old 02-11-2014 , 10:48   Re: [ANY] Map Zones (with forwards)
Reply With Quote #74

I thought elseif statements would die if the if before the elseif is true. I am guessing that there is no way to compound all those 'PrintToChat(client, "%sYou have left \"%s\" zone,stuff", prefix, m_iName[8]); ' into one PrintToChat? Thanks anyways.
__________________
Last edited by ; Today at 08:20 AM. Reason: Get rid of s
captaindeterprimary is offline
Root_
Veteran Member
Join Date: Jan 2012
Location: ryssland
Old 02-11-2014 , 11:34   Re: [ANY] Map Zones (with forwards)
Reply With Quote #75

Quote:
Originally Posted by vman315 View Post
I thought elseif statements would die if the if before the elseif is true.
Unless you put those zones at same position.
Quote:
Originally Posted by vman315 View Post
I am guessing that there is no way to compound all those 'PrintToChat(client, "%sYou have left \"%s\" zone,stuff", prefix, m_iName[8]); ' into one PrintToChat? Thanks anyways.
What is the point of that? Current method is most accurate so far. Anyways if you are interested, use Format or ?: operator.
Code:
// like that decl String:message[128]; Format(message, sizeof(message), "%sYou have entered \"%s\" zone, %s", prefix, m_iName[8], (StrEqual(m_iName[8], "lowgrav", false) ? "set low gravity for you." : "god mode enabled!")); // Not sure if (StrContains(m_iName, "god", false) != -1) will return proper message. PrintToChat(client, message);
__________________


dodsplugins.com - Plugins and Resources for Day of Defeat
http://twitch.tv/zadroot
Root_ is offline
captaindeterprimary
AlliedModders Donor
Join Date: Sep 2012
Old 02-11-2014 , 15:28   Re: [ANY] Map Zones (with forwards)
Reply With Quote #76

I don't think you are understanding what I wanted to do.

The point would be to have a one zone named BluespawnGodLowgravNotarget, and have it fire off aswell as print "You have entered BluespawnGodLowgravNotarget, god mode enabled, low gravity for you, sentries here are friendly.", then say we have another zone called SkyboxLowgravNotarget, and have it fire off aswell as print "You have entered SkyboxLowgravNotarget, low gravity for you, sentries here are friendly."

Instead of making three zones for one area I would like to make one zone that will activate all specified in the name.

Hence why I did

PHP Code:
        if (StrContains(m_iName[8], "god"false)) 
        { 
            
god stuff 
            
if (GetConVarBool(ShowZones)) 
            { 
                
PrintToChat(client"%sYou have left \"%s\" zone."prefixm_iName[8]); 
            } 
        } 
        if (
StrContains(m_iName[8], "lowgrav"false)) 
        { 
            
low gravity stuff 
            
if (GetConVarBool(ShowZones)) 
            { 
                
PrintToChat(client"%sYou have left \"%s\" zone."prefixm_iName[8]); 
            } 
        } 
__________________
Last edited by ; Today at 08:20 AM. Reason: Get rid of s
captaindeterprimary is offline
Root_
Veteran Member
Join Date: Jan 2012
Location: ryssland
Old 02-11-2014 , 15:52   Re: [ANY] Map Zones (with forwards)
Reply With Quote #77

I really dont understand you.... might be due to my low english skills.
Just create zones called god1, god2, god3, compare them within OnEnterEd/LeftProtectedZone callbacks.
At first check for zone with lowgrav and god, like StrEqual(m_iName[8], "MyGodAndLowGravZone", false), then if its werent passed, use StrContains to compare if zone got 'god' name (i assume god1, god2, god3 etc), if not, check for 'lowgrav' zone. Simply ~logic~.
Code:
public Action:OnEnteredProtectedZone(zone, client, const String:prefix[]) {     static Handle:ShowZones   = INVALID_HANDLE;     if (!ShowZones) ShowZones = FindConVar("sm_zones_show_messages");     if (1 <= client <= MaxClients)     {         decl String:m_iName[MAX_NAME_LENGTH*2];         GetEntPropString(zone, Prop_Data, "m_iName", m_iName, sizeof(m_iName));         // Use this to compare if player entered god or lowgrav zone          if (StrContains(m_iName, "god", false) != -1)         || StrContains(m_iName, "lowgrav", false) != -1)         {             // enable godmode             ServerCommand("sm_god #%i 1", GetClientUserId(client));             // set gravity for a player             SetEntityGravity(client, 0.5);             // Show zone name if necessary             if (GetConVarBool(ShowZones))             {                 // Call this whatever you want                 PrintToChat(client, "%sYou have entered \"%s\" zone, god mode and low gravity enabled!", prefix, m_iName[8]);             }         }     } } public Action:OnLeftProtectedZone(zone, client, const String:prefix[]) {     static Handle:ShowZones   = INVALID_HANDLE;     if (!ShowZones) ShowZones = FindConVar("sm_zones_show_messages");     if (1 <= client <= MaxClients)     {         decl String:m_iName[MAX_NAME_LENGTH*2];         GetEntPropString(zone, Prop_Data, "m_iName", m_iName, sizeof(m_iName));         // Same here         if (StrContains(m_iName, "god", false) != -1)         || StrContains(m_iName, "lowgrav", false) != -1)         {             // Reset god and gravity             ServerCommand("sm_god #%i 0", GetClientUserId(client));             SetEntityGravity(client, 1.0);             if (GetConVarBool(ShowZones))             {                 PrintToChat(client, "%sYou have left \"%s\" zone, godmode + lowgrav disabled!", prefix, m_iName[8]);             }         }     } }
__________________


dodsplugins.com - Plugins and Resources for Day of Defeat
http://twitch.tv/zadroot
Root_ is offline
stay.pista
Senior Member
Join Date: Apr 2013
Location: Hungary
Old 02-11-2014 , 16:20   Re: [ANY] Map Zones (with forwards)
Reply With Quote #78

Super Good Work!!!!
__________________


•suяƒ• Since 2008
stay.pista is offline
ArchangelGabriel
Member
Join Date: Jan 2014
Location: United States
Old 02-25-2014 , 18:23   Re: [ANY] Map Zones (with forwards)
Reply With Quote #79

So a tiny little update...
I've recently been testing with this plugin and a teleport plugin and it seems if someone saves their teleport inside a zone, they are free to do whatever they want in that zone. The punishment only takes place if they touch the edges of the zone. Is there anyway to fix that so the whole center of the zone acts like the edges?
__________________
ArchangelGabriel is offline
Maxximou5
AlliedModders Donor
Join Date: Feb 2013
Old 02-28-2014 , 01:42   Re: [ANY] Map Zones (with forwards)
Reply With Quote #80

If I made a zone surrounding the spawn area, and I created a timer to check for how long the client has been in the zone, how would I start the timer if they spawn in the zone already?
As far as I've noticed, the client has to leave the zone and reenter for the timer to initially start.

Last edited by Maxximou5; 02-28-2014 at 01:43.
Maxximou5 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:41.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode