AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   help me... (https://forums.alliedmods.net/showthread.php?t=178169)

aNNNak1N 02-12-2012 10:03

Re: help me...
 
Quote:

Originally Posted by Napoleon_be (Post 1648950)
Did you even test this?

don't work

this work
Code:

#include <amxmodx>
#include <geoip>
#include <colorchat>

#define VERSION "1.0.0"

new szIP[16]

public
plugin_init() {
register_plugin("User Connected", VERSION, "NapoleoN#")

}

public
client_putinserver(id) {
set_task(1.0, "ShowMessage", id)
}

public
ShowMessage(id) {
new
szCountry[32]; geoip_country(szIP, szCountry)
new
szName[32] ; get_user_name(id, szName, charsmax(szName))

ColorChat(id, GREEN, "%s^x01 connected^x03 [%s].", szName, szCountry)
}



But y don't understand why set_task(1.0,...)

RoaR 02-12-2012 10:10

Re: help me...
 
Quote:

Originally Posted by aNNNak1N (Post 1648952)
don't work

this work
Code:

#include <amxmodx>
#include <geoip>
#include <colorchat>

#define VERSION "1.0.0"

new szIP[16]

public
plugin_init() {
   
register_plugin("User Connected", VERSION, "NapoleoN#")
   
}

public
client_putinserver(id) {
   
set_task(1.0, "ShowMessage", id)
}

public
ShowMessage(id) {
    new
szCountry[32]; geoip_country(szIP, szCountry)
    new
szName[32] ; get_user_name(id, szName, charsmax(szName))
   
   
ColorChat(id, GREEN, "%s^x01 connected^x03 [%s].", szName, szCountry)
}



But y don't understand why set_task(1.0,...)

It will show the message first second after connected!

PHP Code:

set_task Float:time, const function[], id 0parameter[]=""len 0flags[]=""repeat 

What each thing in set_task does:
Code:

* Float:time - Interval of timer in second. (minimum 0.1 seconds)
* function[] - A string that contains the public function to run on the timer.
* id - A unique id to assign to the task.
* parameter - An array contain data to send to the timer function.
* len - Size of the array to send to the timer function.
* flags - One of the following: 
-- "a" - Repeat task a specified number of times 
-- "b" - Loop task infinitely 
-- "c" - do task on time after a map timeleft 
-- "d" - do task on time before a map timeleft
* repeat - If flags is "a", specifies the number of times to repeat the task.


aNNNak1N 02-12-2012 10:12

Re: help me...
 
ok's :P


All times are GMT -4. The time now is 12:21.

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