client_disconnect() - Erori

Categoria cu cereri de pluginuri si nu numai.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Forum rules
Accesează link-ul pentru a putea vedea regulile forumului

Daca doriti sa vi se modifice un plugin, va rugam postati aici .
User avatar
Nubo
Fost moderator
Fost moderator
Posts: 2734
Joined: 11 Jul 2012, 18:45
Detinator Steam: Da
CS Status: [əˈnɒn.ɪ.məs]
Reputatie: Fost scripter eXtreamCS
Fost eXtream Mod
Has thanked: 8 times
Been thanked: 27 times

11 Jun 2013, 17:40

Cer iertare de 2x-post... Nu o fac intentionat, nu ma ajuta cu nimic.
Last edited by Nubo on 11 Jun 2013, 17:40, edited 1 time in total.
Cand nu merge acest forum sunt online aici:
  • * Skype: nubo_cs
    * Y!M ID: nubo_cs
RoyalServer
User avatar
Nubo
Fost moderator
Fost moderator
Posts: 2734
Joined: 11 Jul 2012, 18:45
Detinator Steam: Da
CS Status: [əˈnɒn.ɪ.məs]
Reputatie: Fost scripter eXtreamCS
Fost eXtream Mod
Has thanked: 8 times
Been thanked: 27 times

11 Jun 2013, 17:40

Hades, cum ramane cu Spectatorii? Cum am scris mai sus, get_user_team() nu merge bine cu Spectatorii. (sau am gresit eu ceva?)
AskWrite, sa folosesti is_user_connected() in client_disconnect()?? Nu imi pare corect.
cyby, aceeasi intrebare, cum ramane cu Spectatorii?

Va multumesc pentru atentia acordata si sfaturi.

p.s: nu am reusit inca sa testez propunerea lui moder
Cand nu merge acest forum sunt online aici:
  • * Skype: nubo_cs
    * Y!M ID: nubo_cs
User avatar
cyby
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 1777
Joined: 16 Jul 2011, 21:46
Detinator Steam: Da
Detinator server CS: Da
Reputatie: Scripter eXtreamCS
Fost Moderator ajutator
Has thanked: 146 times
Been thanked: 396 times

11 Jun 2013, 17:57

Incearca sa faci un task repetitiv la conectare ca sa ii detecteze echipa cam la 1 minut si sa seteze variabila.
93.114.82.17:27015 - Monster Invasion CO-OP Mod
User avatar
Hades Ownage
Membru eXtream
Membru eXtream
Posts: 3182
Joined: 22 Oct 2008, 10:12
Detinator Steam: Da
Detinator server CS: jb.clutch.ro
SteamID: hades-source
Reputatie: Fost Super Moderator
Fost Scripter eXtreamCS
Nume anterior: hadesownage
Location: Iasi
Has thanked: 324 times
Been thanked: 406 times

11 Jun 2013, 18:25

cyby wrote:
| Afiseaza codul
#include <amxmodx>
#include <hamsandwich>

new bool:tero[33], bool:ct[33];

public plugin_init()
{
	register_plugin("Deconnect team", "1.0", "cyby")
	
	RegisterHam(Ham_Spawn, "player", "player_spawn", 1)
}

public player_spawn(id)
{
	if(is_user_alive(id))
	{
		if(get_user_team(id) == 1)
		{
			tero[id] = true
			ct[id] = false
		}
		else if(get_user_team(id) == 2)
		{
			ct[id] = true
			tero[id] = false
		}
	}
}

public client_disconnect(id)
{
	if(tero[id])
		client_print(id, print_chat, "S-a deconectat un tero")
	else if(ct[id])
		client_print(id, print_chat, "S-a deconectat un CT")
	
	tero[id] = false
	ct[id] = false
}
Cea mai buna solutie, client_disconnect e post (adica dupa, deci ce team sa mai ia?)
Ai facut o prostie mai mare decat tine .

Code: Select all

public client_disconnect (     id     ) {
    
    if ( get_user_team ( id )  == 1 ) {
    
        log_to_file(file,"S-a dec un T")
        
    }
    
    if ( get_user_team ( id ) ) == 2 ) {
        
        log_to_file(file,"S-a dec un CT")
        
    }

    if ( get_user_team ( id ) ) == 3 ) {
        
        log_to_file(file,"S-a dec un SPECTATOR")
        
    }
    
}
Cand ai multe if-uri e recomandat sa folosesti asa:

Code: Select all

public client_disconnect (     id     ) {
        
    switch ( get_user_team ( id ) ) {
        
        case 1:
        {
            log_to_file(file,"S-a dec un T")
            
        }
        
        case 2;
        {
            log_to_file(file,"S-a dec un CT")
        }
        
        case 3:
        {
            log_to_file(file,"S-a dec un SPECTATOR")
        }
    }
} 
User avatar
sDs|Aragon*
Membru, skill +2
Membru, skill +2
Posts: 576
Joined: 29 Dec 2011, 21:38
Detinator Steam: Da
SteamID: Mihai_Parkour10
Reputatie: Fost scripter eXtreamCS
Has thanked: 4 times
Been thanked: 132 times

11 Jun 2013, 18:42

Hades Ownage wrote:
cyby wrote:
| Afiseaza codul
#include <amxmodx>
#include <hamsandwich>

new bool:tero[33], bool:ct[33];

public plugin_init()
{
	register_plugin("Deconnect team", "1.0", "cyby")
	
	RegisterHam(Ham_Spawn, "player", "player_spawn", 1)
}

public player_spawn(id)
{
	if(is_user_alive(id))
	{
		if(get_user_team(id) == 1)
		{
			tero[id] = true
			ct[id] = false
		}
		else if(get_user_team(id) == 2)
		{
			ct[id] = true
			tero[id] = false
		}
	}
}

public client_disconnect(id)
{
	if(tero[id])
		client_print(id, print_chat, "S-a deconectat un tero")
	else if(ct[id])
		client_print(id, print_chat, "S-a deconectat un CT")
	
	tero[id] = false
	ct[id] = false
}
Cea mai buna solutie, client_disconnect e post (adica dupa, deci ce team sa mai ia?)
Ai facut o prostie mai mare decat tine .

Code: Select all

public client_disconnect (     id     ) {
    
    if ( get_user_team ( id )  == 1 ) {
    
        log_to_file(file,"S-a dec un T")
        
    }
    
    if ( get_user_team ( id ) ) == 2 ) {
        
        log_to_file(file,"S-a dec un CT")
        
    }

    if ( get_user_team ( id ) ) == 3 ) {
        
        log_to_file(file,"S-a dec un SPECTATOR")
        
    }
    
} 
Cand ai multe if-uri e recomandat sa folosesti asa:

Code: Select all

public client_disconnect (     id     ) {
        
    switch ( get_user_team ( id ) ) {
        
        case 1:
        {
            log_to_file(file,"S-a dec un T")
            
        }
        
        case 2;
        {
            log_to_file(file,"S-a dec un CT")
        }
        
        case 3:
        {
            log_to_file(file,"S-a dec un SPECTATOR")
        }
    }
}
Este bine Hades, doar ca trebuie sa verificam daca acel jucator este unul care a fost conectat pe server, si nu o entitate sau eu stiu ce alte porcari.
Ar trebui sa functioneaza fara erori. | Afiseaza codul
public client_disconnect(id) {
	if(id <= get_maxplayers() && !is_user_bot(id)) {
		switch(get_user_team(id)) {
			case 1: log_to_file(file,"S-a dec un T")

			case 2: log_to_file(file,"S-a dec un CT")

			case 3: log_to_file(file,"S-a dec un SPECTATOR")

		}
	}
}
Post Reply

Return to “Cereri”

  • Information
  • Who is online

    Users browsing this forum: Dot [Bot] and 33 guests