AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   /ungrav (https://forums.alliedmods.net/showthread.php?t=75250)

KingCommentor 08-01-2008 23:18

/ungrav
 
I wrote a small script to let a user buy lower gravity, is there a command to change it back to normal?

By saying /ungrav

jim_yang 08-01-2008 23:24

Re: /ungrav
 
set_user_gravity(id)

iHaxor.Stan 08-01-2008 23:26

Re: /ungrav
 
the same way you set it to low gravity, but instead of say "0.25" or something, set the number to 1 so it's 800 gravity.

KingCommentor 08-01-2008 23:44

Re: /ungrav
 
New to scripting, starting off small, kinda like this?

PHP Code:

#include <amxmodx> 
#include <amxmisc> 
#include <cstrike> 
#include <fakemeta> 
#define PLUGIN "TESTING" 
#define VERSION "1.0" 
#define AUTHOR "kingcommentor" 
new price 
new enabled 
new g_MsgSync 
public plugin_init() 

 
register_plugin(PLUGINVERSIONAUTHOR
 
register_clcmd("say /grav","GravOn"
 
register_clcmd("say /ungrav","GravOff"
 
price register_cvar("amx_grav_price""1000"
 
enabled register_cvar("amx_grav_enabled""1"
 
g_MsgSync CreateHudSyncObj() 

public 
GravOn(id

 new 
money cs_get_user_money(id
 new 
tprice get_pcvar_num(price); 
 if (
get_pcvar_num(enabled) == 1
 { 
  if (
money tprice
  { 
   
client_print(id,print_chat,"You don't have enough money! Gravity currently costs %d!" tprice
  } 
  else 
  { 
   
set_hudmessage(01272550.300.2906.0,15.0
   
ShowSyncHudMsg(idg_MsgSync,"Your gravity is now 400"
   
set_pev(idpev_gravity0.50
   
cs_set_user_money(idmoney-tprice
  } 
 } 

public 
GravOff(id)
 {
 
set_user_gravity(id1)
 
set_hudmessage(01272550.300.2906.0,15.0
 
ShowSyncHudMsg(idg_MsgSync,"Your gravity is not back to normal")



jim_yang 08-01-2008 23:46

Re: /ungrav
 
you need to include fun module to use the native
set_user_gravity(id)
1.0 is default value of the 2nd param

fakemeta way is set_pev(id, pev_gravity, 1.0)

KingCommentor 08-01-2008 23:53

Re: /ungrav
 
How do I make scrolling message every, say .. 5 minutes?

grimvh2 08-02-2008 08:17

Re: /ungrav
 
maybe instead of making them say /ungrav take away gravity after the round ends

PHP Code:

#include <amxmodx> 
#include <amxmisc> 
#include <cstrike> 
#include <fakemeta> 
#define PLUGIN "TESTING" 
#define VERSION "1.0" 
#define AUTHOR "kingcommentor" 
new price 
new enabled 
new g_MsgSync 
public plugin_init() 

 
register_plugin(PLUGINVERSIONAUTHOR
 
register_clcmd("say /grav","GravOn")
 
register_logevent("EndRound",2,"0=World triggered""1=Round_Draw""1=Round_End");
 
price register_cvar("amx_grav_price""1000"
 
enabled register_cvar("amx_grav_enabled""1"
 
g_MsgSync CreateHudSyncObj() 

public 
GravOn(id

 new 
money cs_get_user_money(id
 new 
tprice get_pcvar_num(price); 
 if (
get_pcvar_num(enabled) == 1
 { 
  if (
money tprice
  { 
   
client_print(id,print_chat,"You don't have enough money! Gravity currently costs %d!" tprice
  } 
  else 
  { 
   
set_hudmessage(01272550.300.2906.0,15.0
   
ShowSyncHudMsg(idg_MsgSync,"Your gravity is now 400 untill the round ends"
   
set_pev(idpev_gravity0.50
   
cs_set_user_money(idmoney-tprice
  } 
 } 


/* Round Ends */
public EndRound()
{
    new 
players[32], pnum
    get_players
(playerspnum)
    for( new 
0pnumi++ )
    {
        
set_pev(players[i], pev_gravity1.0)
    }    



xPaw 08-02-2008 13:49

Re: /ungrav
 
add to plugin_init();
PHP Code:

set_task(520.0"GravADS"

PHP Code:

public GravADS() {
  
// ads code bla bla

set_task(520.0"GravADS")



KingCommentor 08-02-2008 16:54

Re: /ungrav
 
It automatically is removed at round end for some reason, I never added anything to make it do such a thing.

iHaxor.Stan 08-02-2008 19:09

Re: /ungrav
 
That's because it just does that. You have to set it on every round start if you don't want that to happen.


All times are GMT -4. The time now is 05:36.

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