Raised This Month: $32 Target: $400
 8% 

change map in plugin script?


Post New Thread Reply   
 
Thread Tools Display Modes
suhdude
Senior Member
Join Date: Mar 2016
Location: Sweden
Old 11-13-2017 , 12:31   Re: change map in plugin script?
Reply With Quote #11

Quote:
Originally Posted by OciXCrom View Post
If you looked ad the API, you should have noticed that the function (if the name itself wasn't clear enough) belongs in the engine module, so add #include <engine>.
I have tried including engine, it seemed clear to me but it still doesent work.
suhdude is offline
suhdude
Senior Member
Join Date: Mar 2016
Location: Sweden
Old 11-13-2017 , 12:35   Re: change map in plugin script?
Reply With Quote #12

Quote:
Originally Posted by siriusmd99 View Post
You would go obviously for server_cmd function. If you don't have basic knowledge of amxx scripting you could just start a thread in "Suggestions / Requests" section.
Btw, I believe there are bunch of such plugins. Just try to search.

P.S. If you want to echo the map changing process, you can just use admin slash plugin and change map by using short command in chat /map "map_name"
I did not know of server_cmd, maybe it was obvious but you are still the first to suggest it.
I could create a topic in "requests" for every little thing I want to change, but I want to learn and there is more people willing to help me build my own plugins then there are people that take requests.
suhdude is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 11-13-2017 , 13:00   Re: change map in plugin script?
Reply With Quote #13

Quote:
Originally Posted by suhdude View Post
I have tried including engine, it seemed clear to me but it still doesent work.
The api page contains information from the dev amxx version(1.8.3). engine_changelevel, IIRC, was added in 1.8.3, so if you are running 1.8.2 it won't work. Better check the local include files from your installation.
__________________
HamletEagle is offline
suhdude
Senior Member
Join Date: Mar 2016
Location: Sweden
Old 11-13-2017 , 14:08   Re: change map in plugin script?
Reply With Quote #14

Quote:
Originally Posted by HamletEagle View Post
The api page contains information from the dev amxx version(1.8.3). engine_changelevel, IIRC, was added in 1.8.3, so if you are running 1.8.2 it won't work. Better check the local include files from your installation.
Indeed I am running 1.8.2.
I installed just a month ago from the http://www.amxmodx.org/ page.
I found 1.8.3 here: http://www.amxmodx.org/snapshots.php

Do I need base and cstrike?
Also I should take git5144 right?

Thank you.
suhdude is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 11-13-2017 , 14:33   Re: change map in plugin script?
Reply With Quote #15

Quote:
Do I need base and cstrike?
Exactly, and metamod.

Quote:
Also I should take git5144 right?
This is no more than a version, then take the lastest.

Some plugins doesn't work with 1.8.3, if you didn't do any change.

Last edited by CrazY.; 11-13-2017 at 14:38.
CrazY. is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 11-13-2017 , 15:18   Re: change map in plugin script?
Reply With Quote #16

Quote:
Originally Posted by CrazY. View Post
Some plugins doesn't work with 1.8.3, if you didn't do any change.
If you find any plugin that works on 1.8.2, but not on 1.8.3, report it. That's considered a bug as AMXX is backwards-compatible.
klippy is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 11-13-2017 , 17:25   Re: change map in plugin script?
Reply With Quote #17

Quote:
Originally Posted by suhdude View Post
Hmm, I'm a little confused here.

1. I have already put: register_clcmd("say /rt_nuke", "de_nuke") // and tried different functions. You want me to just register register_clcmd("say", "de_nuke")?
2. When I test it with "say", I have checked that / is the first thing i put before mapname. What first character do you want me to look for?
3. Do you want me to do: engine_changelevel("/cstrike/maps/de_aztec_go"); ? Or is this post made to help me not have to do multiple functions?
4. Map definetly exists in cstrike/maps, and is added to amx maps.ini

Thank you for being patient me.
no, I was explaining how to create "dynamic" commands as in every single map installed can be set with /mapname without editing the plugin even if you add new maps

I should've thought you won't understand since you don't have basic programming knowledge, so there is no use in further discussing unless I write the whole code for you

also, don't take this the wrong way, but until you at least grasp the fundamentals of programming (things that are univeral regardless of programming language, such as function prototypes, variables, braces, strings, arrays, loops) there is no way anyone can help you without giving you the code

I would strongly suggest you read this whole thing http://www.amxmodx.org/doc/index.htm...%2Fscripts.htm and maybe even go as far as following a basic C / C++ course online, at least until you get familiarised with the fundamentals; that is of course if you want to learn how to create plugins on your own, without trying 50 different things until it finally works (you'll never be able to do this except with really simple plugins)

don't take this as discouragement, I started the same way as you, I'm just trying to save you some time because you'll eventually have to bite the bullet and learn this stuff
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.

Last edited by aron9forever; 11-13-2017 at 17:26.
aron9forever is offline
suhdude
Senior Member
Join Date: Mar 2016
Location: Sweden
Old 11-13-2017 , 22:42   Re: change map in plugin script?
Reply With Quote #18

Quote:
Originally Posted by aron9forever View Post
no, I was explaining how to create "dynamic" commands as in every single map installed can be set with /mapname without editing the plugin even if you add new maps

I should've thought you won't understand since you don't have basic programming knowledge, so there is no use in further discussing unless I write the whole code for you

also, don't take this the wrong way, but until you at least grasp the fundamentals of programming (things that are univeral regardless of programming language, such as function prototypes, variables, braces, strings, arrays, loops) there is no way anyone can help you without giving you the code

I would strongly suggest you read this whole thing http://www.amxmodx.org/doc/index.htm...%2Fscripts.htm and maybe even go as far as following a basic C / C++ course online, at least until you get familiarised with the fundamentals; that is of course if you want to learn how to create plugins on your own, without trying 50 different things until it finally works (you'll never be able to do this except with really simple plugins)

don't take this as discouragement, I started the same way as you, I'm just trying to save you some time because you'll eventually have to bite the bullet and learn this stuff
Looking at what you wrote again, I think I do understand what you suggested.
I gave it a shot, but unfortunately its not working..

Code:
public plugin_init() {     register_clcmd( "say", "hooksay" ) } public hooksay(id) {     new mapname[128]     read_args(mapname, charsmax(mapname))     remove_quotes(mapname)     copy(mapname,127,mapname[1])     if (file_exists("cstrike/maps/%s.bsp",mapname[1]))         {         server_cmd("changelevel %s",mapname[1])         }     return PLUGIN_CONTINUE }

I don't know what level you have to be on to ask for help on this forum, but every time I do ask I learn something.
And today I learnt something that I have no idea how to figure out reading a document.
I'm not saying that I would not benefit greatly from doing so, or that you're wrong.
But I would have no idea that I needed to download another version of amx for these functions to work.

I am thankfull for your guide on how to do what I asked for, and yes it is beyond my skill level.
But still, now I know what I need to know and I can go straight for it and learn how to do just that.
Time efficent? Not in the long run no.. And I'm sorry if you feel that I am wasting your time.

Thanks again for replying to so many of my threads.

Last edited by suhdude; 11-13-2017 at 23:46.
suhdude is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 11-14-2017 , 06:45   Re: change map in plugin script?
Reply With Quote #19

I suggest better to send command amx_map to admin with client_cmd(id, "amx_map %s", map name), because this way map is changed with delay and information about the admin who changed the map.
If you use changelevel directly through server command line then it will change instantly, so that's not gonna fit OK in my opinion.
siriusmd99 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-14-2017 , 21:50   Re: change map in plugin script?
Reply With Quote #20

I recommend that you take some time to read through some basic tutorials. Most specifically in this case, you don't understand how strings work in this language. There is a very good explanation of strings in this tutorial (part 2).

Also, you should learn to read the compiler errors that you get. You would learn that file_exists() doesn't take multiple parameters. In fact, not all functions that take string arguments can do formatting. You would need to format before hand and then pass the full string to that function.

If you are intending for people to use a slash (/) before the map name, you should first check that the first character is a slash. If it is not a slash, you should not execute any further code. This will prevent your function from unnecessarily taking much longer than it needs for cases where it's not even meant for this functionality.
__________________
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 23:51.


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