AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problem: with TE_DLIGHT 27 (https://forums.alliedmods.net/showthread.php?t=24676)

Stephen 02-28-2006 18:38

Problem: with TE_DLIGHT 27
 
Code:

public worldlight(id, level, cid)
{
        if(!cmd_access(id,level,cid,5))
                return PLUGIN_HANDLED

        new user[33], space[1], r[4], g[4], b[4], bright[1], time[1], rate[1]
        read_argv(0, user, 32)

        read_argv(1, space, 1)//RADIUS
        new radius = str_to_num(space)

        read_argv(2, r, 3)//Colors
        read_argv(3, g, 3)
        read_argv(4, b, 3)
        new red = str_to_num(r)
        new green = str_to_num(g)
        new blue = str_to_num(b)

        read_argv(5, bright, 1)//Brightness
        new brightness = str_to_num(bright)

        read_argv(6, time, 1)//LifeTime
        new life = str_to_num(time)

        read_argv(7, rate, 1)//Decayrate
        new decayrate = str_to_num(rate)

        new origin[3]
        get_user_origin(id,origin)
        message_begin(MSG_BROADCAST,SVC_TEMPENTITY, origin)
        write_byte( TE_DLIGHT )
        write_coord( origin[0] ); //coord coord coord (position)
        write_coord( origin[1] );
        write_coord( origin[2] );
        write_byte( radius ) //Radius
        write_byte( red ) //Red
        write_byte( green ) //Green
        write_byte( blue ) //Blue
        write_byte( brightness ) //Brightness
        write_byte( life ) //Life
        write_byte( decayrate ) //Decay Rate
        message_end();

        return PLUGIN_HANDLED
}

This is the current snippet i use, BUT it throws me back out to the starting menu.
It does this once i reched the part where i input the BLUE in the console
Radius, red,green = no crash when i press button
radius, red,green, BLUE = crash when i press button

GHW_Chronic 02-28-2006 18:50

you do:

amx_command Chr 52 255 0 CRASH? While you are typing the command the server crashes?

And what is the "user" variable for? It appears to me that you don't use it in the snippet you gave us.

Jordan 02-28-2006 18:59

Code:
read_argv(0, user, 32)

He uses it for that, but I'm not sure if it relates to anything else.

Stephen 02-28-2006 18:59

This is the snippet i use.

what i do in console is this

.fx.fxWorldLight (the i press enter so i get these displayed radius], [red], [green], [blue], [brightness], [float:lifetime], [float:decayrate])

then i type again .fx.fxWorldLight but with 10 then i press enter and nothing happens

i do the same again .fx.fxWorldLight 10 255 and i press enter nothing happens

.fx.fxWorldLight 10 255 0 = nothing happen after pressed
.fx.fxWorldLight 10 255 0 0 = crash

It crashes everytime on the fourth Number when i enter it or more then four.
______
if i dont use
read_argv(0, user, 32)

i get an compile warning/error

Stephen 02-28-2006 19:23

This is how i use it atm

Dont mide the unused includes, cause there is more whre is going to be used.

Code:

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <amxmisc>
#include <string>
#include <fun>

#define TE_DLIGHT 27
#define TE_ELIGHT 28

public plugin_init()
{
        register_plugin("stuff","Beta","Stephen")
        register_clcmd(".fx.fxWorldLight","worldlight",ADMIN_ALL,"[radius], [red], [green], [blue], [brightness], [float:lifetime], [float:decayrate]")

        return PLUGIN_CONTINUE;
}
//World Light
//===================
public worldlight(id, level, cid)
{
        if(!cmd_access(id,level,cid,5))
                return PLUGIN_HANDLED

        new user[33], space[1], r[4], g[4], b[4], bright[1], time[1], rate[1]
        read_argv(0, user, 32)

        read_argv(1, space, 1)//RADIUS
        new radius = str_to_num(space)

        read_argv(2, r, 3)//Colors
        read_argv(3, g, 3)
        read_argv(4, b, 3)
        new red = str_to_num(r)
        new green = str_to_num(g)
        new blue = str_to_num(b)

        read_argv(5, bright, 1)//Brightness
        new brightness = str_to_num(bright)

        read_argv(6, time, 1)//LifeTime
        new life = str_to_num(time)

        read_argv(7, rate, 1)//Decayrate
        new decayrate = str_to_num(rate)

        new origin[3]
        get_user_origin(id,origin)
        message_begin(MSG_BROADCAST,SVC_TEMPENTITY, origin)
        write_byte( TE_DLIGHT )
        write_coord( origin[0] ); //coord coord coord (position)
        write_coord( origin[1] );
        write_coord( origin[2] );
        write_byte( radius ) //Radius
        write_byte( red ) //Red
        write_byte( green ) //Green
        write_byte( blue ) //Blue
        write_byte( brightness ) //Brightness
        write_byte( life ) //Life
        write_byte( decayrate ) //Decay Rate
        message_end();

        return PLUGIN_HANDLED
}
//Screen Fade
//===================


c0rdawg 02-28-2006 19:26

use the small tag instead of the code tag to display your plugin source

Stephen 02-28-2006 19:27

:D
Lol sry but i didnt understand that.
im not an pro in coding at all :oops: .

can you make an snippet ?

GHW_Chronic 02-28-2006 19:28

Code:
   if(!cmd_access(id,level,cid,5))            return PLUGIN_HANDLED
change to
Code:
   if(!cmd_access(id,level,cid,8))            return PLUGIN_HANDLED
should work. Because you were putting 0 in for
Code:
   write_byte( brightness ) //Brightness    write_byte( life ) //Life    write_byte( decayrate ) //Decay Rate
thus causing ur server to go "brightness 0? life 0? decayrate 0? WTF?! IM SO CONFUSED!"
http://upload.wikimedia.org/wikipedi...r_fireball.jpg

Stephen 02-28-2006 19:34

ok i change the 5 to 8

Now i dont crash anymore when it comes to color blue.
^^

BUT when i type an higher number then 20 in Decayrate spot i get thrown out again in to the gamestartup screen

it says something with BadServerParseMessage or something like this.


BUT when it works the effect only stays for an short amount no matter how much time i put in.

=O i want these Fields customizable when i type them in the console ^^

Stephen 03-01-2006 04:45

Anyone knows how to make that better ?
And so that the Effect doesnt dissapear after 0.5 seconds ?

___
never mind i found that out now :o


All times are GMT -4. The time now is 20:23.

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