AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Remove a block in a map (https://forums.alliedmods.net/showthread.php?t=89744)

micke1101 04-10-2009 04:09

Remove a block in a map
 
Hi i remember there was a topic about copyrighting maps and they said the only way was adding a block at the spawn points so that they couldnt play and to play it you could make a plugin that removes this block anyone have a visual example on this would be helpful thanks:mrgreen:

fysiks 04-10-2009 08:26

Re: Remove a block in a map
 
To keep people from playing a map on a different server you can remove the spawn entities from the downloaded version of the map.

Hunter-Digital 04-10-2009 09:29

Re: Remove a block in a map
 
Or you could make the map with a solid block like you said on the spawn points and set it to a func_wall entity and give it a name, then in an ammx plugin search for those entites and remove them... easy...

but, for experienced mappers and/or scripters other people can remove that block too... they can get the name of the block and all that :}

micke1101 04-10-2009 09:49

Re: Remove a block in a map
 
Yea but can atleast try :mrgreen:
Do you know how to do it? and if so could you show me the code with maybe small notes to understand?

Hunter-Digital 04-10-2009 11:28

Re: Remove a block in a map
 
You know how to do the map ?

As for the code...
PHP Code:

#include <amxmodx>
#include <engine>
 
#define SECURENAME "map_block_name"
 
// ...
 
public plugin_precache()
{
         new 
ententName[32]
 
         while((
ent find_ent_by_class(ent"func_wall")) != 0// search through all func_wall entities
         
{
                  
pev(entpev_targetnameentName31// get it's name
 
                  
if(!equal(entNameSECURENAME)) // if it's not your block name, continue to the next one
                           
continue
 
                  
remove_entity(ent// if it is, remove it...
         
}


Don't really know if this works but it's a starting point :mrgreen:

micke1101 04-10-2009 11:48

Re: Remove a block in a map
 
Yes i know how to do the map :P
But it didnt compile at least not in the webcompiler

Hunter-Digital 04-10-2009 12:46

Re: Remove a block in a map
 
compile it locally and see what errors it returns...

also add plugin_init() ...

micke1101 04-10-2009 13:37

Re: Remove a block in a map
 
Code:

#include <amxmodx>
#include <engine>
 
#define SECURENAME "copyright_block"

public plugin_init()
{
    register_plugin("moon_base_copyright","1.0","Hunter-Digital")
}
public plugin_precache()
{
        new ent, entName[32]
 
        while((ent = find_ent_by_class(ent, "func_wall")) != 0) // search through all func_wall entities
        {
                  pev(ent, pev_targetname, entName, 31) // get it's name
 
                  if(!equal(entName, SECURENAME)) // if it's not your block name, continue to the next one
                          continue
 
                  remove_entity(ent) // if it is, remove it...
        }
}

Quote:

Originally Posted by compiler
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

/home/groups/amxmodx/tmp3/textwrxxcu.sma(16) : error 017: undefined symbol "pev"
/home/groups/amxmodx/tmp3/textwrxxcu.sma(16) : warning 215: expression has no effect
/home/groups/amxmodx/tmp3/textwrxxcu.sma(16) : warning 215: expression has no effect
/home/groups/amxmodx/tmp3/textwrxxcu.sma(16) : error 001: expected token: ";", but found ")"
/home/groups/amxmodx/tmp3/textwrxxcu.sma(16) : error 029: invalid expression, assumed zero
/home/groups/amxmodx/tmp3/textwrxxcu.sma(16) : fatal error 107: too many error messages on one line

Compilation aborted.
4 Errors.


Hunter-Digital 04-10-2009 14:21

Re: Remove a block in a map
 
whoops :)) include fakemeta :mrgreen:


All times are GMT -4. The time now is 02:16.

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