AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problem: With creating EntityLight with custom Fields. (https://forums.alliedmods.net/showthread.php?t=24672)

Stephen 02-28-2006 14:36

Problem: With creating EntityLight with custom Fields.
 
Quote:

register_clcmd(".fx.fxEntityLight","EntityLig ht",ADMIN_ALL,"[coord], [coord], [coord], [Radius], [Red], [Green], [Blue], [Life], [DecayRate]")
Quote:


//Entity Light
//===================
public EntityLight(id, level, cid)
{
if(!cmd_access(id,level,cid,2))
return PLUGIN_HANDLED

new szArg0[32]
read_argv(1,szArg0,31)
new szArg1[32]
read_argv(1,szArg1,31)
new szArg2[32]
read_argv(1,szArg2,31)
new szArg3[32]
read_argv(1,szArg3,31)
new szArg4[32]
read_argv(1,szArg4,31)
new szArg5[32]
read_argv(1,szArg5,31)
new szArg6[32]
read_argv(1,szArg6,31)

if( !strlen(szArg0)|| !strlen(szArg1)|| !strlen(szArg2)|| !strlen(szArg3)|| !strlen(szArg4)|| !strlen(szArg5)|| !strlen(szArg6))
return PLUGIN_HANDLED

new spriteorigin4[3]
get_user_origin(id, spriteorigin4)
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte( TE_ELIGHT )
write_short( id )
write_coord( szArg0[0] ); //coord coord coord (position)
write_coord( szArg0[1] );
write_coord( szArg0[2] );
write_coord( szArg1 ) //coord radius
write_byte( szArg2 ) //Red
write_byte( szArg3 ) //Green
write_byte( szArg4 ) //Blue
write_byte( szArg5 ) //Life
write_coord( szArg6 ) //Decay Rate
message_end();

return PLUGIN_HANDLED
}
I wondered how i could make it so that when i wanna create that light that i can summon it in the color i want.
So i can enter custom number before it shows up.

c0rdawg 02-28-2006 14:56

isn't it this

Code:
write_byte( szArg2 ) //Red write_byte( szArg3 ) //Green write_byte( szArg4 ) //Blue

Stephen 02-28-2006 14:58

:?:
Hmm.
Sry but i dont understand what you mean.

c0rdawg 02-28-2006 15:01

well thats the code for changing the color, so you have to just make a command to write the colors you want to that

Stephen 02-28-2006 15:06

Erm
Can you make an example of what you exactly meant this to be ?

Cause i thought its done with

new szArg1[32]
read_argv(1,szArg1,31)
new szArg2[32]
read_argv(1,szArg2,31)
new szArg3[32]
read_argv(1,szArg3,31)
new szArg4[32]
read_argv(1,szArg4,31)
new szArg5[32]
read_argv(1,szArg5,31)
new szArg6[32]
read_argv(1,szArg6,31)


And these Lines give me errors in compiling
write_coord( szArg1 ) //coord radius
write_byte( szArg2 ) //Red
write_byte( szArg3 ) //Green
write_byte( szArg4 ) //Blue
write_byte( szArg5 ) //Life
write_coord( szArg6 ) //Decay Rate

c0rdawg 02-28-2006 15:09

for each szArg1[32] you are setting them to the first argument, you need it to be like

Code:
new szArg1[32] read_argv(1,szArg1,31) new szArg2[32] read_argv(2,szArg2,31) new szArg3[32] read_argv(3,szArg3,31) new szArg4[32] read_argv(4,szArg4,31) new szArg5[32] read_argv(5,szArg5,31) new szArg6[32] read_argv(6,szArg6,31)

Stephen 02-28-2006 15:19

hmm ok.

I still get the same errors by compiling.
onthese Lines
Code:

write_coord( szArg1 ) //coord radius
write_byte( szArg2 ) //Red
write_byte( szArg3 ) //Green
write_byte( szArg4 ) //Blue
write_byte( szArg5 ) //Life
write_coord( szArg6 ) //Decay Rate

Full code
Code:

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

#define TE_ELIGHT 28

public plugin_init()
{
        register_plugin("stuff","Beta","Stephen")
        register_clcmd(".fx.fxEntityLight","EntityLight",ADMIN_ALL,"[coord], [coord], [coord], [Radius], [Red], [Green], [Blue], [Life], [DecayRate]")
       
        return PLUGIN_CONTINUE;
}
//Entity Light
//===================
public EntityLight(id, level, cid)
{
        if(!cmd_access(id,level,cid,2))
                return PLUGIN_HANDLED

            new szArg0[32]
        read_argv(0,szArg0,31)

        new szArg1[32]
        read_argv(1,szArg1,31)       

        new szArg2[32]
        read_argv(2,szArg2,31)

        new szArg3[32]
        read_argv(4,szArg3,31)

        new szArg4[32]
        read_argv(4,szArg4,31)

        new szArg5[32]
        read_argv(5,szArg5,31)

        new szArg6[32]
        read_argv(6,szArg6,31)

            if(!strlen(szArg0)||!strlen(szArg1)||!strlen(szArg2)||!strlen(szArg3)||!strlen(szArg4)||!strlen(szArg5)||!strlen(szArg6))
        return PLUGIN_HANDLED

            new spriteorigin4[3]
        get_user_origin(id, spriteorigin4)
        message_begin(MSG_BROADCAST,SVC_TEMPENTITY)       
        write_byte( TE_ELIGHT )
        write_short( id )
        write_coord( szArg0[0] ); //coord coord coord (position)
        write_coord( szArg0[1] );
        write_coord( szArg0[2] );
        write_coord( szArg1 ) //coord radius
        write_byte( szArg2 ) //Red
        write_byte( szArg3 ) //Green
        write_byte( szArg4 ) //Blue
        write_byte( szArg5 ) //Life
        write_coord( szArg6 ) //Decay Rate
        message_end();

            return PLUGIN_HANDLED
}


c0rdawg 02-28-2006 15:29

whats the error?

Stephen 02-28-2006 15:34

The errors are "argument type mismatch <argument 1>

And to be true i dont know what decay rate is. I think its the speed of the Vanishing entity light.

c0rdawg 02-28-2006 15:40

hmmm, well i think it reads that arguments as strings, so you might have to do str_to_num for your rgb stuff


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

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