AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   My script doesnt work (https://forums.alliedmods.net/showthread.php?t=75001)

josepi 07-28-2008 20:16

My script doesnt work
 
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fun>

new Float:g_Speed

public plugin_init() 
{
register_plugin("Speed Configurator","1.0","HeAd")
register_event("ResetHUD""Event""be")
g_Speed register_cvar("amx_playerspeed","-1.0")
return 
PLUGIN_CONTINUE 
}

public 
Event(id)
{  
if(
g_Speed <= 0){
g_Speed = -1.0
}
set_task(3.0"Speed"id)
return 
PLUGIN_CONTINUE
}


public 
Speed(id){
new 
Float:speed g_Speed 
set_user_maxspeed(id speed); 
client_print(id,print_chat,"[SERVER] La velocidad del jugador es de %d",speed)
return 
PLUGIN_HANDLED



I want is to change player speed , and every round player speed should be changed with the speed saved on cvar.

PvtSmithFSSF 07-28-2008 22:33

Re: My script doesnt work
 
Unfortunately with cs, speed is tricky. Each time you switch weapons speed is reset

ot_207 07-29-2008 00:36

Re: My script doesnt work
 
Well I have to point out that there are a lot of errors in your script.
I will write the script for you when you have understood what I've said.

PHP Code:

new Float:g_speed
g_speed 
register_cvar("<name>","<value>"

This means that g_speed becoms the cvar pointer of the cvar <name>
And in this situation g_speed isn't a float value, its an integer value.
It can have the value 10 , 540 , 3214. Depending on how many cvars your server has, so the way you have done it doesn't make sense.

So we change it to:
PHP Code:

new g_speed_cvar
g_speed_cvar 
register_cvar("name","value"

To change the speed player all the time it is best to use prethink
PHP Code:

register_forward(FM_PlayerPreThink,"function"// in plugin_init

public function(id)
{
if (!
is_user_alive(id))
return 
FMRES_IGNORED
set_user_maxspeed
(id,get_pcvar_num(g_speed_cvar))

return 
FMRES_IGNORED




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

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