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

Simple task dose not work. argument type mismatch(argument 1)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hay
Junior Member
Join Date: Jun 2018
Old 06-08-2018 , 14:04   Simple task dose not work. argument type mismatch(argument 1)
Reply With Quote #1

Tried to print to chat player health, I had a few problems. argument type mismatch(argument 1)

Quote:
public Action:Command_health(client,args)
{
int y = GetClientHealth(client);
PrintToChatAll(y);
}
Some help?
Hay is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 06-08-2018 , 14:11   Re: Simple task dose not work. argument type mismatch(argument 1)
Reply With Quote #2

Quote:
Originally Posted by Hay View Post
Tried to print to chat player health, I had a few problems. argument type mismatch(argument 1)



Some help?
Code:
public Action Command_health(int client, int args)
{
     int y = GetClientHealth(client);
     PrintToChatAll("%i", y);
}
This is converted completely to new syntax.
Also you formatted PrintToChatAll incorrectly.
You should take a look at the sourcemod API
It's a great reference. Also if in doubt google
search Allied Modders PrintToChatAll, good luck.
MasterMind420 is offline
Hay
Junior Member
Join Date: Jun 2018
Old 06-08-2018 , 14:35   Re: Simple task dose not work. argument type mismatch(argument 1)
Reply With Quote #3

Quote:
Originally Posted by MasterMind420 View Post
Code:
public Action Command_health(int client, int args)
{
     int y = GetClientHealth(client);
     PrintToChatAll("%i", y);
}
This is converted completely to new syntax.
Also you formatted PrintToChatAll incorrectly.
You should take a look at the sourcemod API
It's a great reference. Also if in doubt google
search Allied Modders PrintToChatAll, good luck.
First thanks for the help, Sec I need to use it more than 1 time. and its give me the error: "Number of arguments does not a definition" I Looked out for it and didn't find .

Last edited by Hay; 06-08-2018 at 14:39.
Hay is offline
pride95
Senior Member
Join Date: Aug 2015
Old 06-08-2018 , 14:43   Re: Simple task dose not work. argument type mismatch(argument 1)
Reply With Quote #4

Quote:
Originally Posted by Hay View Post
First thanks for the help, Sec I need to use it more than 1 time. and its give me the error: "Number of arguments does not a definition" I Looked out for it and didn't find .
PHP Code:

int Client
Money;
char[100String;

PrintToChatAll("%d %d %s"ClientMoneyString); 
3 parameters, 3 formats (%d, %d, %s)

%d or %i for int
%s for char vector (char[])
%c for char character (char)
%f for float
%N for client name
pride95 is offline
Hay
Junior Member
Join Date: Jun 2018
Old 06-08-2018 , 14:48   Re: Simple task dose not work. argument type mismatch(argument 1)
Reply With Quote #5

Quote:
Originally Posted by pride95 View Post
PHP Code:

int Client
Money;
char[100String;

PrintToChatAll("%d %d %s"ClientMoneyString); 
3 parameters, 3 formats (%d, %d, %s)

%d or %i for int
%s for char vector (char[])
%c for char character (char)
%f for float
%N for client name
tnx again, but what the problem with this code? -
Quote:
public Action:Command_health(client,args)
{
int health = GetClientHealth(client);
int name = GetClientName(client);
PrintToChatAll("%N","%i",name, health);
}
Error - "Number of arguments does not definition"

Last edited by Hay; 06-08-2018 at 14:51.
Hay is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 06-08-2018 , 14:59   Re: Simple task dose not work. argument type mismatch(argument 1)
Reply With Quote #6

Change "%N","%i" to just "%N %i"...anything printed goes within a single parenthesis.

PrintToChatAll("%d %d %s", Client, Money, String); Like pride95's example

Last edited by MasterMind420; 06-08-2018 at 15:00.
MasterMind420 is offline
Hay
Junior Member
Join Date: Jun 2018
Old 06-08-2018 , 15:06   Re: Simple task dose not work. argument type mismatch(argument 1)
Reply With Quote #7

Quote:
Originally Posted by MasterMind420 View Post
Change "%N","%i" to just "%N %i"...anything printed goes within a single parenthesis.

PrintToChatAll("%d %d %s", Client, Money, String); Like pride95's example
Thanks again and sorry for bothering, I did it and it still made the error (number of arguments does not match definition) in the name line -

Quote:
public Action:Command_health(client, args)
{
int health = GetClientHealth(client);
int name = GetClientName(client);
PrintToChatAll("%i %N ", health, name)
}
Hay is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 06-08-2018 , 16:05   Re: Simple task dose not work. argument type mismatch(argument 1)
Reply With Quote #8

PHP Code:
int health GetClientHealth(client);
PrintToChatAll("%N %d"clienthealth); 
The "%N" automatically gets the name of whatever index you use. Since you're getting the client's name, just use "client" as your index.
__________________

Last edited by Psyk0tik; 06-08-2018 at 16:06.
Psyk0tik is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 06-08-2018 , 19:51   Re: Simple task dose not work. argument type mismatch(argument 1)
Reply With Quote #9

Quote:
Originally Posted by Crasher_3637 View Post
PHP Code:
int health GetClientHealth(client);
PrintToChatAll("%N %d"clienthealth); 
The "%N" automatically gets the name of whatever index you use. Since you're getting the client's name, just use "client" as your index.
Very good point lol...I completely overlooked that
MasterMind420 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:52.


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