Raised This Month: $ Target: $400
 0% 

Command accepting partial names?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 09-06-2004 , 02:11   Command accepting partial names?
Reply With Quote #1

How can I get a command to accept partial names? This is my code so far:
Code:
public changeboost(id) {     if(! get_user_flags(id) && ADMIN_KICK)         return PLUGIN_HANDLED     new target[31]     new boost[20]     new tgtid     new boostamo     read_argv(1,target,30)     read_argv(2,boost,19)     tgtid = get_user_index(target)     boostamo = str_to_num(boost)     if(boostamo < 0)         boostamo = 0     boostamount[tgtid] = boostamo     return PLUGIN_HANDLED }
Thank you for your time.
__________________
twistedeuphoria is offline
BAILOPAN
Join Date: Jan 2004
Old 09-06-2004 , 02:40  
Reply With Quote #2

Use cmd_target()
__________________
egg
BAILOPAN is offline
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 09-06-2004 , 02:59  
Reply With Quote #3

Like this?
Code:
public changeboost(id) {     if(! get_user_flags(id) && ADMIN_KICK)         return PLUGIN_HANDLED     new target[31]     new boost[20]     new tgtid     new boostamo     read_argv(1,target,30)     new player = cmd_target(id,target,1)     if(!player) return PLUGIN_HANDLED     read_argv(2,boost,19)     tgtid = get_user_index(target)     boostamo = str_to_num(boost)     if(boostamo < 0)         boostamo = 0     boostamount[tgtid] = boostamo     return PLUGIN_HANDLED }
__________________
twistedeuphoria is offline
Votorx
Senior Member
Join Date: Jun 2004
Old 09-06-2004 , 04:19  
Reply With Quote #4

Yes but player is now that player's id. so you don't need to do tgtid = get_user_index(target)
__________________
Currently Looking for a mod team.
Votorx is offline
Send a message via AIM to Votorx Send a message via MSN to Votorx Send a message via Yahoo to Votorx
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 09-06-2004 , 15:07  
Reply With Quote #5

Thanks, but for some reason when you use it on someone it says invalid command. It does the command, but it prints invalid command in console.

Edit: Nvm I got it thanks guys.
__________________
twistedeuphoria 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 17:24.


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