AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Spawn client [FM] (https://forums.alliedmods.net/showthread.php?t=205474)

alonelive 01-11-2013 01:19

Spawn client [FM]
 
Hello!

This simple code not works correctly:
PHP Code:

public plugin_init()
{
set_task(15.0"simple_spawn"3423354)
}

public 
simple_spawn()
{
    
    new 
players[32], inum
    get_players
(playersinum"h")
        
    for (new 
0inum; ++i)
    {
            if(
cs_get_user_team(players[i]) == CS_TEAM_CT || CS_TEAM_CT)
            {
            
dllfunc(DLLFunc_Spawni)
            }
    }
    
remove_task(3423354)


_____________________________________________ _________________________
And with this version i have an errors in server's console:
PHP Code:

public plugin_init()
{
set_task(15.0"simple_spawn"3423354)
}

public 
simple_spawn(id)
{
            
dllfunc(DLLFunc_Spawnid)
            
remove_task(3423354)


Code:

L 01/11/2013 - 10:17:04: [FAKEMETA] Invalid entity
L 01/11/2013 - 10:17:04: [AMXX] Run time error 10 (plugin "test.amxx") (native "dllfunc") - debug not enabled!
L 01/11/2013 - 10:17:04: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).

_____________________________________________ _________________________
In this ver. all works fine. Paradox..

PHP Code:

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say ss""ssfc")
    
// Add your code here...
}

public 
ssfc(id) {
    
dllfunc(DLLFunc_Spawnid)


How i can execute function DDLFuncf_Spawn for all players ?

wickedd 01-11-2013 02:44

Re: Spawn client [FM]
 
Why not use HAM?

alonelive 01-11-2013 02:50

Re: Spawn client [FM]
 
Quote:

Originally Posted by wickedd (Post 1871369)
Why not use HAM?

Players spawn without death (simple return to team spawn place). Players' weapons must remain.
I use this code for some effects.
Can you help me with topic's question?

It's hard to explain it in English. In Russian, I would be happy to explain)

YamiKaitou 01-11-2013 11:17

Re: Spawn client [FM]
 
plugin_init is too early to call this.... What exactly are you trying to do? Why can you not use Ham_CS_RoundRespawn?

AngeIII 01-12-2013 08:34

Re: Spawn client [FM]
 
not preffer to set task in init..

PHP Code:

public plugin_init()
{
set_task(15.0"simple_spawn"3423354)
}

public 
simple_spawn()
{
    
    new 
players[32], inum
    get_players
(playersinum"h")
        
    for (new 
0inum; ++i)
    {
            if((
cs_get_user_team(players[i]) == CS_TEAM_CT) || (cs_get_user_team(players[i])==CS_TEAM_T)) 
            {
           
// dllfunc(DLLFunc_Spawn, players[i]) // dont use this: https://forums.alliedmods.net/showpost.php?p=1872093&postcount=8
              
ExecuteHamBHam_CS_RoundRespawnplayers[i] );
            }
    }



jimaway 01-12-2013 08:37

Re: Spawn client [FM]
 
Quote:

Originally Posted by AngeIII (Post 1872078)
not preffer to set task in init..

PHP Code:

public plugin_init()
{
set_task(15.0"simple_spawn"3423354)
}

public 
simple_spawn()
{
    
    new 
players[32], inum
    get_players
(playersinum"h")
        
    for (new 
0inum; ++i)
    {
            if(
cs_get_user_team(players[i]) == CS_TEAM_CT || CS_TEAM_CT)
            {
            
dllfunc(DLLFunc_Spawnplayers[i])
            }
    }



if(cs_get_user_team(players[i]) == CS_TEAM_CT || CS_TEAM_CT)
how useless is this?
if (true) will do the same thing lol

AngeIII 01-12-2013 08:43

Re: Spawn client [FM]
 
heh yeah.
if((cs_get_user_team(players[i]) == CS_TEAM_CT) || (cs_get_user_team(players[i])==CS_TEAM_T))

ConnorMcLeod 01-12-2013 09:04

Re: Spawn client [FM]
 
DLLFunc_Spawn is not intended to respawn a player, only to spawn entities.
For players, use MUST use ham, use RoundRespawn.

alonelive 01-12-2013 10:48

Re: Spawn client [FM]
 
Thank you all! AngeIII's version works fine!

AngeIII 01-12-2013 10:49

Re: Spawn client [FM]
 
use this :
ExecuteHamB( Ham_CS_RoundRespawn, players[i] );


All times are GMT -4. The time now is 13:47.

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