AlliedModders

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

WaZZeR++ 05-15-2005 13:16

string help
 
i want to change
Code:
g_Answer = "banid 30.0 %s kick"

to banid <arg2> %s kick

how can i change the string?

EDIT:
Waht does this return if there isnt any arg?
Code:
new arg2[32] read_argv(2,arg2,31)

v3x 05-15-2005 14:02

[EDIT]

1)
Code:
new banmsg[64] format(banmsg,63,"ban %d %s kick",arg1,arg2) server_cmd(banmsg)
I assume that's what you want.

2) It returns false or 0.

IE:
Code:
if(!arg2) {     // blah blah .. } if(arg2==0) {     // blah blah .. }

WaZZeR++ 05-15-2005 14:16

not really, I still want the %s to be there...

v3x 05-15-2005 14:21

IE: banid 0.0 STEAM_0:0:3611880
That's a number, so you want %d there. :)

WaZZeR++ 05-15-2005 14:46

Code:
/* Vote Ban */ 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? "banid " : "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 }
and this
Code:
 g_Answer = arg2? "banid %d %s kick" : "banid 30.0 %s kick"

but i want %d to be arg2

so the output is ie: "banid 0.0 s% kick"

but I dont even knew if this script will work. Im trying to modyfy the adminvote.sma so you can vote tempban....


All times are GMT -4. The time now is 16:45.

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