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

reviveme plugin , only i can use it


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
rom2311
Junior Member
Join Date: Sep 2013
Old 09-28-2013 , 15:27   reviveme plugin , only i can use it
Reply With Quote #1

Hello,
i built a reviveme plugin , it works fine exept that it seems only i can use it, i asked my friend to come to the server and when he tried to use the command : reviveme , nothing happened for him.
when i try it works fine.
can someone help me understanding what is the problem with the code ?

Code :
http://pastebin.com/kMrgtJEE
rom2311 is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 09-28-2013 , 15:34   Re: reviveme plugin , only i can use it
Reply With Quote #2

That's not how you get command arguments from a chat message.
id is the index of the player that wrote the message. When you write the command you have the index 1 and it works, but your friend has the index 2. Then you use that index in read_argv (which is wrong), and the plugin tries to get the second argument which doesn't exist.

But you don't even need to parse any arguments, you can directly register the command with:
PHP Code:
register_clcmd("say /revive","reviveMeFunc"
__________________

Last edited by <VeCo>; 09-28-2013 at 15:34.
<VeCo> is offline
rom2311
Junior Member
Join Date: Sep 2013
Old 09-28-2013 , 15:57   Re: reviveme plugin , only i can use it
Reply With Quote #3

the read_argv is the way my friend taught me so i used it , if i will use the register_clcmd way it will work fine ?
rom2311 is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 09-28-2013 , 16:01   Re: reviveme plugin , only i can use it
Reply With Quote #4

Yes.
Your friend is wrong, the proper way of reading chat arguments is using read_args, then removing the quotes from the string and parsing it. That's usually used when you have a command like "/trail 1 blue" to read the values, but in your case it's just a simple command "/reviveme" and you don't need to get anything from it.
__________________

Last edited by <VeCo>; 09-28-2013 at 16:02.
<VeCo> is offline
rom2311
Junior Member
Join Date: Sep 2013
Old 09-28-2013 , 16:54   Re: reviveme plugin , only i can use it
Reply With Quote #5

Quote:
Originally Posted by <VeCo> View Post
Yes.
Your friend is wrong, the proper way of reading chat arguments is using read_args, then removing the quotes from the string and parsing it. That's usually used when you have a command like "/trail 1 blue" to read the values, but in your case it's just a simple command "/reviveme" and you don't need to get anything from it.
ty very much, works great now ^^
rom2311 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 21:21.


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