AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Is this a good script? [admin_respawn.sma] (https://forums.alliedmods.net/showthread.php?t=87143)

crazyeffect 03-07-2009 11:48

Is this a good script? [admin_respawn.sma]
 
1 Attachment(s)
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <engine>
 
#define MAP_MAX   3800.0
 
public plugin_init()
{
 
register_plugin("Admin Spawn""1.0""GameFreak")
 
register_clcmd("say /respawn""cmd_buyspawn")
}
 
public 
cmd_buyspawn(id)
{
 if(
get_user_flags(id) & ADMIN_KICK)
 {
  
set_hudmessage(02550, -1.0, -1.0)
  
show_hudmessage(id"You respawned!")
 
  
random_spawn(id)
 }
 
 else
 {
  
client_print(idprint_center"[CrazY EffecT] You have no acces to this command!")
 }
}
public 
random_spawn(id)
{
 static 
Float:vOrigin[3],iContents
 
 vOrigin
[0] = random_float(-MAP_MAX,MAP_MAX)
 
vOrigin[1] = random_float(-MAP_MAX,MAP_MAX
 
vOrigin[2] = -MAP_MAX
 
 
do
 {
  if(
vOrigin[2] > MAP_MAX)
   return 
random_spawn(id)
 
  
vOrigin[2] += 10.0
  iContents 
PointContents(vOrigin)
 }
 while(
iContents != CONTENTS_EMPTY)
 
 
vOrigin[2] += 200.0
 
if(PointContents(vOrigin) != CONTENTS_EMPTY)
  return 
random_spawn(id)
 
vOrigin[2] -= 160.0
 
 
for(new iCount 0;iCount 2;iCount++)
 {
  for(new 
Float:flDist = -36.0;flDist 36.0;flDist += 36.0)
  {
   
vOrigin[2] += flDist
 
   vOrigin
[iCount] += 33.0
   
if(PointContents(vOrigin) != CONTENTS_EMPTY)
    return 
random_spawn(id)
   
vOrigin[iCount] -= 33.0
 
   vOrigin
[iCount] -= 33.0
   
if(PointContents(vOrigin) != CONTENTS_EMPTY)
    return 
random_spawn(id)
   
vOrigin[iCount] += 33.0  
 
   vOrigin
[2] -= flDist
  
}
 }
 
 new 
iEnt
 
while((iEnt find_ent_in_sphere(iEnt,vOrigin,20.0)) != 0)
  if(
entity_get_int(iEnt,EV_INT_solid) != SOLID_NOT && entity_get_int(id,EV_INT_solid) != SOLID_TRIGGER)
   return 
random_spawn(id)
 
 
entity_set_vector(id,EV_VEC_origin,vOrigin)
 
 if(
entity_get_int(id,EV_INT_flags) & FL_INWATER)
  return 
PLUGIN_CONTINUE
 
 
new iEnts[1]
 
find_sphere_class(id,"player",200.0,iEnts,1)
 
 if(
iEnts[0])
  return 
random_spawn(id)
 
 
set_task(0.1,"fnCheckLocation",id)
 
 return 
PLUGIN_CONTINUE
}
public 
random_spawn_location(id)
{
 new 
iFlags entity_get_int(id,EV_INT_flags)
 if(
iFlags FL_INWATER || iFlags FL_SWIM || iFlags FL_FLOAT)
  
random_spawn(id)



iNspiratioN 03-07-2009 12:47

Re: Is this a good script? [admin_respawn.sma]
 
What do you mean? You want us to check the code?

crazyeffect 03-07-2009 13:05

Re: Is this a good script? [admin_respawn.sma]
 
Yes, i'm not a good scripter, i'm still learning :D

iNspiratioN 03-07-2009 13:10

Re: Is this a good script? [admin_respawn.sma]
 
Got any error's?

anakin_cstrike 03-07-2009 13:46

Re: Is this a good script? [admin_respawn.sma]
 
Check Mole from shopmenu @ war3ft.

crazyeffect 03-07-2009 13:59

Re: Is this a good script? [admin_respawn.sma]
 
I don't got errors, but if i type /respawn, i don't respawn :(

There just is a message: You respawned

Starsailor 03-07-2009 14:08

Re: Is this a good script? [admin_respawn.sma]
 
check this

http://forums.alliedmods.net/showpos...98&postcount=2

DruGzOG 03-07-2009 14:40

Re: Is this a good script? [admin_respawn.sma]
 
1 Attachment(s)
do you want them to spawn by purchasing it or respawn by typing it?

EDIT: Try This

Code:

#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <engine>
new PLUG[] = "Admin Respawn";
new VERS[] = "1.0";
new AUTH[] = "LeviN";
public plugin_init()
{
    register_plugin(PLUG, VERS, AUTH);
   
    RegisterHam(Ham_DeathNotice, "player", "player_death", 1);
   
    register_clcmd("say /respawn", "cmd_buyspawn");
    register_clcmd("say_team /respawn", "cmd_buyspawn");
}
public cmd_buyspawn(id)
{
 if(get_user_flags(id) & ADMIN_KICK)
 {
  set_hudmessage(0, 255, 0, -1.0, -1.0)
  show_hudmessage(id, "You respawned!")
  set_task(1.0, "StartSpawn", id);
 }
 
 else
 {
  client_print(id, print_center, "[CrazY EffecT] You have no acces to this command!")
 }
}
public StartSpawn(id)
{
    if(!is_user_alive(id))
    {
        cs_set_user_team(id, CS_TEAM_T);
        set_task(1.0, "spawn_again", id);
    }
    return PLUGIN_HANDLED;
}
public spawn_again(id)
{
    ExecuteHamB(Ham_CS_RoundRespawn,id);
}


crazyeffect 03-08-2009 06:47

Re: Is this a good script? [admin_respawn.sma]
 
None of those works...

@starsailor
I need a plugin when you type /respawn (you need to be admin) that you need to respawn

@DrugZog
Just doesnt work...

DruGzOG 03-08-2009 10:44

Re: Is this a good script? [admin_respawn.sma]
 
1 Attachment(s)
Try This


All times are GMT -4. The time now is 08:50.

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