Raised This Month: $51 Target: $400
 12% 

string help agen


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
WaZZeR++
Veteran Member
Join Date: Mar 2005
Location: Sweden
Old 05-18-2005 , 14:02   string help agen
Reply With Quote #1

I have a problem. I have a string:
Code:
g_Answer = arg2? "banid %d %s kick" : "banid 30.0 %s kick"
But i want the %d to be replaced by arg2. So the output become ie:
Code:
g_Answer = "banid 120.0 %s kick"
WaZZeR++ is offline
Send a message via MSN to WaZZeR++
Jinto
Member
Join Date: Jun 2004
Location: Seattle, WA
Old 05-18-2005 , 17:01  
Reply With Quote #2

Code:
new szBanString[128];
format( szBanString, 127, "banid %d %s kick", arg1, arg2 );
use format to format the string how you want.
Jinto is offline
Send a message via ICQ to Jinto Send a message via AIM to Jinto Send a message via MSN to Jinto Send a message via Yahoo to Jinto
WaZZeR++
Veteran Member
Join Date: Mar 2005
Location: Sweden
Old 05-19-2005 , 16:02  
Reply With Quote #3

will this work?
Code:
format( g_Answer, 127, "banid %d %s kick", arg2 );

will the %s still be there?
WaZZeR++ is offline
Send a message via MSN to WaZZeR++
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 05-20-2005 , 21:51  
Reply With Quote #4

You've got a decimal (%d) and a string (%s) and only 1 arg, so.. nope.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Jinto
Member
Join Date: Jun 2004
Location: Seattle, WA
Old 05-20-2005 , 23:08  
Reply With Quote #5

Actually v3x your wrong.. %d is an integer
Jinto is offline
Send a message via ICQ to Jinto Send a message via AIM to Jinto Send a message via MSN to Jinto Send a message via Yahoo to Jinto
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 05-20-2005 , 23:47  
Reply With Quote #6

My bad.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
WaZZeR++
Veteran Member
Join Date: Mar 2005
Location: Sweden
Old 05-21-2005 , 09:03  
Reply With Quote #7

ok, have any idea how to make the output become:
"banid 120.0 %s kick"?

think this will work:
Code:
format( g_Answer, 127, "banid %d %s kick", arg2, "%s" );
WaZZeR++ is offline
Send a message via MSN to WaZZeR++
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 05-21-2005 , 14:41  
Reply With Quote #8

Post the whole function, please.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
WaZZeR++
Veteran Member
Join Date: Mar 2005
Location: Sweden
Old 05-21-2005 , 17:11  
Reply With Quote #9

Im trying to modify the amx_voteban so you can ban by time...

Code:
/* Vote Ban amx_voteban <id> [time]*/ public cmdVoteBan(id,level,cid) {   if (!cmd_access(id,level,cid,2))     return PLUGIN_HANDLED   new Float:voting = get_cvar_float("amx_last_voting")   if (voting > get_gametime()) {     console_print(id, "%L", id, "ALREADY_VOTING")     return PLUGIN_HANDLED   }   if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {     console_print(id, "%L", id, "VOTING_NOT_ALLOW")     return PLUGIN_HANDLED   }   new cmd[32]   read_argv(0,cmd,31)   new voteban = equal(cmd,"amx_voteban")   new arg[32]   read_argv(1,arg,31)   new player = cmd_target(id,arg,1)   if (!player) return PLUGIN_HANDLED   if (voteban && is_user_bot(player)) {     new imname[32]     get_user_name(player,imname,31)     console_print(id,"%L",id,"ACTION_PERFORMED",imname)     return PLUGIN_HANDLED   }   new arg2[32]   read_argv(2,arg2,31)   new keys = MENU_KEY_1|MENU_KEY_2   new menu_msg[256],lYes[16],lNo[16],lKickBan[16]   format(lYes,15,"%L",LANG_SERVER,"YES")   format(lNo,15,"%L",LANG_SERVER,"NO")   format(lKickBan,15,"%L",LANG_SERVER,"BAN")   ucfirst(lKickBan)   get_user_name(player,arg,31)   format(menu_msg,255,g_coloredMenus ?     "\y%s %s?\w^n^n1.  %s^n2.  %s" :     "%s %s?^n^n1.  %s^n2.  %s",     lKickBan, arg, lYes, lNo)   g_yesNoVote = 1   get_user_authid(player,g_optionName[0],31)   new authid[32],name[32]   get_user_authid(id,authid,31)   get_user_name(id,name,31)   log_amx("Vote: ^"%s<%d><%s><>^" vote %s (target ^"%s^")",     name,get_user_userid(id),authid,"ban",arg)   new activity = get_cvar_num("amx_show_activity")   if (activity>0) {     new players[32],pnum,lTag[16]     get_players(players,pnum,"c")     for (new i=0;i<pnum;i++) {       format(lTag,15,"%L",players[i],is_user_admin(id)?"ADMIN":"USER")       format(lKickBan,15,"%L",players[i],"BAN")       switch (activity) {         case 2: client_print(players[i],print_chat,"%L",           players[i],"ADMIN_VOTE_FOR_2",lTag,name,lKickBan,arg)         case 1: client_print(players[i],print_chat,"%L",           players[i],"ADMIN_VOTE_FOR_1",lTag,lKickBan,arg)       }     }   }   g_execResult = true   new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0   set_cvar_float("amx_last_voting"get_gametime() + vote_time )   g_voteRatio = get_cvar_float("amx_voteban_ratio")   g_Answer = arg2? format("banid %d %s kick",arg2) : "banid 30.0 %s kick"   show_menu(0,keys,menu_msg,floatround(vote_time),"Ban ")   set_task(vote_time,"checkVotes" , 99889988 )   g_voteCaller = id   console_print(id, "%L", id, "VOTING_STARTED")   g_voteCount = {0,0,0,0}   return PLUGIN_HANDLED }
WaZZeR++ is offline
Send a message via MSN to WaZZeR++
Zky
Member
Join Date: Nov 2005
Old 06-14-2006 , 15:02  
Reply With Quote #10

it's work ?
Zky is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:00.


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