Raised This Month: $51 Target: $400
 12% 

on map


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MacL
Member
Join Date: May 2021
Old 06-15-2021 , 15:36   on map
Reply With Quote #1

hey alliedmodders, How do I make the plugin work only on specific maps? ( i do not mean make cfg files). i want something like this :
Code:
if(map("de_" , "fy_") return Plugin_Handled;
MacL is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 06-15-2021 , 16:50   Re: on map
Reply With Quote #2

Quote:
Originally Posted by MacL View Post
hey alliedmodders, How do I make the plugin work only on specific maps? ( i do not mean make cfg files). i want something like this :
Code:
if(map("de_" , "fy_") return Plugin_Handled;
PHP Code:
new szMapName[64]
get_mapname(0szMapName63)
If(
szMapNameequal ("de_")) return; 
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.
Supremache is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-15-2021 , 21:21   Re: on map
Reply With Quote #3

Quote:
Originally Posted by Supremache View Post
PHP Code:
new szMapName[64]
get_mapname(0szMapName63)
If(
szMapNameequal ("de_")) return; 
No. You may want to test code before posting.

_____________________________________________ ____________

@MacL, this is a Scripting Help question so you should post things like this in Scripting Help in the future.

You would use get_mapname() and equal() to compare only the first X number of characters (because both examples given only have 3 characters, you would set argument 'c' to 3).

If you have differing sizes of prefixes, you may want to consider breaking the string with something like strtok() using the underscore as a tocken and comparing the first result to your prefixes.

_____________________________________________ ____________

For others who might want it: No plugin code modification required, simply configure the plugin to only load on the maps you want: https://wiki.alliedmods.net/Configur...ecific_Plugins
__________________

Last edited by fysiks; 06-15-2021 at 21:29.
fysiks is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 06-15-2021 , 21:48   Re: on map
Reply With Quote #4

Spoiler


Edit:
If you want to start plugins on specific map type:
1. Go to addons/amxmodx/configs/maps (if the folder haven't exists, create it)
2. create the file with the name like plugins-fy.ini (replace fy with any prefix of the map like de, cs,...)
3. Input any plugins you want to run on those specific map type.
__________________
My plugin:

Last edited by Celena Luna; 06-15-2021 at 21:53.
Celena Luna is offline
Old 06-15-2021, 22:22
fysiks
This message has been deleted by fysiks. Reason: nvm . . .
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 06-16-2021 , 00:29   Re: on map
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
No. You may want to test code before posting.
[/url]
I know, I was on the phone when I typed that code and I was want to give him an example for how to do that "calling native get_mapname and using equal"
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 06-16-2021 at 00:35.
Supremache is offline
MacL
Member
Join Date: May 2021
Old 06-16-2021 , 08:01   Re: on map
Reply With Quote #6

Thank you guys.
MacL is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-16-2021 , 22:16   Re: on map
Reply With Quote #7

Quote:
Originally Posted by Supremache View Post
PHP Code:
new szMapName[64]
get_mapname(0szMapName63)
If(
szMapNameequal ("de_")) return; 
Quote:
Originally Posted by Supremache View Post
I know, I was on the phone when I typed that code and I was want to give him an example for how to do that "calling native get_mapname and using equal"
If you don't know the functions, provide only psuedo code or a description (like you just did in this post) so that the requester doesn't think that your code is accurate. Or better yet, wait until you can test it and then post.
__________________

Last edited by fysiks; 06-16-2021 at 22:17.
fysiks 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 16:05.


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