SphereCommunity
Add Function Help - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Add Function Help (/Thread-Add-Function-Help)



Add Function Help - Van Glan Bloom - 10-08-2014 07:49 AM

Hi guys,

I'm trying to add a function to all the players participating in an event, but something is going wrong. The Event start but the function is not added.

This is my script :


Code:
[FUNCTION HUNGERGAMES_start]
IF (<VAR.HUNGERGAMES_PLAYERS> > 1)
    SRC.EVENT_HUNGER_GAMES_DM // This function should be added
    SERV.ALLCLIENTS SYSMESSAGE @09c1 [Hunger Games]: The Event has begun! Event Gate is now closed.
...
....

This is the Function

Code:
[FUNCTION EVENT_HUNGER_GAMES_DM]
if !(<src.tag0.events>==e_event_hungergames)
    src.sysmessage @09c1 You have 30 minutes for the Deathmach!
        serv.newitem event_hunger_games_dm_memory
            serv.newitem event_hunger_games_dm_timer
        src.act.equip
    endif
return 1

The Timer and Memory

Code:
[ITEMDEF EVENT_HUNGER_GAMES_DM_memory]
ID=i_memory
TYPE=t_eq_script
NAME=Event Hunger Games DM Memory

on=@create
attr=04

ON=@equip
timer=60

on=@timer
IF (<CONT>)
    IF (<MORE1>)
        CONT.MESSAGE=<EVAL <MORE1>>
        MORE1=<MORE1> +- 1
        TIMER=1
        RETURN 1
    ENDIF
cont.go 6116,1234,1
remove
return 1

[ITEMDEF EVENT_HUNGER_GAMES_DM_TIMER]
ID=i_memory
TYPE=t_eq_script
NAME=Event Hunger Games DM Timer

on=@create
attr=04
more=9

ON=@equip
timer=1

on=@timer
IF ( <CONT> )
    IF ( <MORE1> )
            MORE1=<MORE1>-1
            TIMER=1
            RETURN 1
        ELSE
        REMOVE
    ENDIF
ENDIF
RETURN 1

Someone help me


RE: Add Function Help - Extreme - 10-08-2014 08:22 AM

Code:
[FUNCTION HUNGERGAMES_start]
IF (<dVAR0.HUNGERGAMES_PLAYERS> > 1)
    SERV.ALLCLIENTS EVENT_HUNGER_GAMES_DM // This function should be added
    SERV.ALLCLIENTS SYSMESSAGE @09c1 [Hunger Games]: The Event has begun! Event Gate is now closed.
...
....

Code:
[FUNCTION EVENT_HUNGER_GAMES_DM]
if !(<src.isevent.e_event_hungergames>)
    src.sysmessage @09c1 You have 30 minutes for the Deathmach!
    serv.newitem event_hunger_games_dm_memory
    src.equip <new>
    serv.newitem event_hunger_games_dm_timer
    src.equip <new>
    src.events +e_event_hungergames
endif
return 1



RE: Add Function Help - XuN - 10-08-2014 08:39 PM

Quote:
Code:
[FUNCTION EVENT_HUNGER_GAMES_DM]
if !(<src.isevent.e_event_hungergames>)
    src.sysmessage @09c1 You have 30 minutes for the Deathmach!
    serv.newitem event_hunger_games_dm_memory
    src.equip <new>
    serv.newitem event_hunger_games_dm_timer
    src.equip <new>
    src.events +e_event_hungergames
endif
return 1

SRC should be removed from this function because SRC will be the object calling the 'HUNGERGAMES_start' function and checks/functions will be called on it/him instead of on who you want (the client(s)).
Do NOT use SRC in everything unless you know that you need it.


RE: Add Function Help - Van Glan Bloom - 10-08-2014 10:28 PM

I have change the script, but not work =/ I have change to the SRC for SERV dont work to


RE: Add Function Help - Extreme - 10-09-2014 01:08 AM

(10-08-2014 08:39 PM)XuN Wrote:  
Quote:
Code:
[FUNCTION EVENT_HUNGER_GAMES_DM]
if !(<src.isevent.e_event_hungergames>)
    src.sysmessage @09c1 You have 30 minutes for the Deathmach!
    serv.newitem event_hunger_games_dm_memory
    src.equip <new>
    serv.newitem event_hunger_games_dm_timer
    src.equip <new>
    src.events +e_event_hungergames
endif
return 1

SRC should be removed from this function because SRC will be the object calling the 'HUNGERGAMES_start' function and checks/functions will be called on it/him instead of on who you want (the client(s)).
Do NOT use SRC in everything unless you know that you need it.
I know, I just replicate what he sent lol