AlliedModders

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

extreem 04-18-2011 16:47

Help please
 
HI. Can you halp me.
I am new in scripting and want know where I must use that - %d, %s and ohter in client print. I can't find it.
I make my first plugin (or remake)
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <colorchat>

#define PLUGIN "sayomg"
#define VERSION "1.0"
#define AUTHOR "Extreem"
new p_URL
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /rs""reset_score")
    
register_clcmd("say /resetscore""reset_score")
    
p_URL register_cvar("web_url","URL")
    
}
public 
reset_score(id)
{
    
cs_set_user_deaths(id0)
    
set_user_frags(id0)
    
cs_set_user_deaths(id0)
    
set_user_frags(id0)
    new 
name[33]
    
get_user_name(idname32)
    
ColorChat(0NORMAL"^1%s Player^4 %s^x01 reset score with usig command ^4 /rs"p_URLname)
}
public 
client_putinserver(id)
{
        
set_task(10.0"connectzprava"id__"a"1)
}
public 
connectzprava(id)
{
    new 
name[33]
    
get_user_name(idname32)
    if(
is_user_connected(id))
    {
    
ColorChat(idNORMAL"^1%s Dear^4 %s^1, for resetscore use command ^4/rs",p_URLname)
    }


And in chat I have that
Code:

sayomg Player Extreem reset score with usig command /rs

fysiks 04-18-2011 18:27

Re: Help please
 
You have to use

PHP Code:

new some_string_here[50]
get_pcvar_string(p_URLsome_string_herecharsmax(some_string_here)) 

Then use some_string_here in client_print() where you have p_URL.

DjOptimuS 04-18-2011 20:55

Re: Help please
 
%s means string
%d and %i are the same, means integer (number)

so, if you use get_cvar_string for example, you must use %s and for get_cvar_num you must use %i

extreem 04-19-2011 10:21

Re: Help please
 
fysiks, thanx for kode.
DjOptimus, where I can read all rules of that ?

fysiks 04-19-2011 18:44

Re: Help please
 
Quote:

Originally Posted by extreem (Post 1453566)
DjOptimus, where I can read all rules of that ?

It's similar to the printf() function from C++. Google it. Not everything will work though, so don't expect everything to work when coding with AMX Mod X.


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

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