AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need a little help. (https://forums.alliedmods.net/showthread.php?t=10492)

clubz 02-21-2005 03:32

Need a little help.
 
Am I doing this right, cause when I connect to server I don't see text.
Code:

// -cLuBz-

#include <amxmodx>

public plugin_init() {
        register_plugin("Test","0.00","cLuBz")
}

public client_connect(id) {
        client_print(id,print_chat,"Test")
}


v3x 02-21-2005 03:35

It is probably printing it when the map changes and the very first round starts, and that could be the reason that you aren't seeing it :).

clubz 02-21-2005 03:43

Anyway to change that?

xeroblood 02-21-2005 10:16

you could use client_putinserver() which is called _after_ client_connect()...

Also, you could use a set_task() to delay the printing of your text a few seconds..

Code:
// -cLuBz- #include <amxmodx> #define TASK_ID 1234 public plugin_init() {    register_plugin("Test","0.00","cLuBz") } public client_putinserver(id) {    new sid[2]    sid[0] = id     // Show text in 3.0 seconds..     set_task( 3.0, "ShowText", TASK_ID, sid, 1 ) } public ShowText( args[] ) {     new id = sid[0]    client_print(id,print_chat,"Test") }

clubz 02-21-2005 13:18

Code:

// -cLuBz-

#include <amxmodx>

#define TASK_ID 1234

public plugin_init() {
  register_plugin("Test","0.00","cLuBz")
}

public client_putinserver(id) {
  new sid[2]
  sid[0] = id

    // Show text in 3.0 seconds..
    set_task(3.0,"ShowText",TASK_ID,sid,1)
}

public ShowText(args[]) {
    new id = sid[0]
  client_print(id,print_chat,"Test")
}

I get 4 errors though..

/home/users/amxmodx/tmp/phpaFp0Sw.sma(16) : warning 217: loose indentation
/home/users/amxmodx/tmp/phpaFp0Sw.sma(20) : error 017: undefined symbol "sid"
/home/users/amxmodx/tmp/phpaFp0Sw.sma(20) : warning 215: expression has no effect
/home/users/amxmodx/tmp/phpaFp0Sw.sma(20) : error 001: expected token: ";", but found "]"
/home/users/amxmodx/tmp/phpaFp0Sw.sma(20) : error 029: invalid expression, assumed zero
/home/users/amxmodx/tmp/phpaFp0Sw.sma(20) : fatal error 107: too many error messages on one line

xeroblood 02-21-2005 13:44

Oooops.. my bad.. I should've tried compiling it first... :P

Code:
#include <amxmodx> #define TASK_ID 1234 public plugin_init() {     register_plugin("Test","0.00","cLuBz") } public client_putinserver(id) {     new sid[2]     sid[0] = id     // Show text in 3.0 seconds..     set_task(3.0,"ShowText",TASK_ID,sid,1)     return PLUGIN_CONTINUE } public ShowText(args[]) {     new id = args[0]     client_print(id,print_chat,"Test") }

If you get loose indentation warnings it is okay, not that important, but if you don't want the warnings and cant find the problem in your code, then just put this at the top of your code:

#pragma tabsize 0

Hope that helps..

clubz 02-21-2005 13:58

Yes it works! thanks.


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

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