Raised This Month: $ Target: $400
 0% 

Client with that name...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
shine771
Senior Member
Join Date: Jun 2007
Old 07-09-2007 , 07:48   Client with that name...
Reply With Quote #1

The script is SO easy, but i have problems with it that i Can't solve...

Code:
Code:
public death()
{
 new killed_player = read_data(2)
 
 new killed_name[32]
 get_user_name(killed_player,killed_name,31)
 
 if(get_pcvar_num(killed) == 1) {
  server_cmd("amx_ban %d %s %s", get_pcvar_num(bantime), killed_name, get_pcvar_num(reason))
 }
 else if(get_pcvar_num(killed) == 2) {
  server_cmd("amx_kick %s %s", killed_name, get_pcvar_num(reason))
 }
 return PLUGIN_CONTINUE
}
It doesn't do anything. Only in server console it shows:

Client With That Name Or Userid Not Found

I tried almost every way but it still doesn't work.
No errors Compiling.
Can someone help me?
Thanks
shine771 is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 07-09-2007 , 08:56   Re: Client with that name...
Reply With Quote #2

Here is the correct way!

Code:
static const g_reason[] = "blah blah....."
 
public plugin_init() {
     ....
     register_event("DeathMsg", "death_msg", "a")
}
 
public death_msg()
{
     new victim = read_data(2)
 
     switch(get_pcvar_num(killed))
     {
           case 1:
               server_cmd("amx_ban #%i %d ^"%s^"", get_user_userid(victim), get_pcvar_num(bantime), g_reason)
 
           case 2:
               server_cmd("kick #%i ^"%s^"", get_user_userid(victim), g_reason)
     }
}
Also i see you use "get_pcvar_num(reason)" ,that is incorrect! You must use "get_pcvar_string(pcvar)" to get a string!
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 07-09-2007 at 08:59.
Alka is offline
shine771
Senior Member
Join Date: Jun 2007
Old 07-09-2007 , 08:57   Re: Client with that name...
Reply With Quote #3

Code:
register_event("DeathMsg", "death_msg", "a")
Code:
public death_ms()


Thanks

EDIT: I know that's incorrect! But with get_pcvar_string it didn't work. I just tried get_pcvar_num and there were no errors. Then i posted here. And changed the script back: get_pcvar_string... And forgot to edit it here.

Last edited by shine771; 07-09-2007 at 09:24.
shine771 is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 07-09-2007 , 21:47   Re: Client with that name...
Reply With Quote #4

Code:
String[156]; get_pcvar_string(pcvar, String, 155);
Code:
native get_pcvar_string(pcvar, string[], maxlen);
__________________
DO NOT PM me about avp mod.
Rolnaaba 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:32.


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