SendClientMessage.
#1

Hey guys i am back with my weird errors i made this shit:
PHP код:
CMD:score(playeridparams[])
{
    new 
string[32];
    new 
score;
    
GetPlayerScore(playerid);
    
format(string,sizeof(string),"You Score Is : %d.",score);
    
SendClientMessage(playerid,COLOR_GREEN,string);

And when i try it it works but under the message sent its writted SERVER:Unknow Command i dont get it the command works but why i see that thing ?
Reply
#2

This should work.
PHP код:
CMD:score(playeridparams[]) 

    new 
string[32]; 
    
format(string,sizeof(string),"You Score Is : %d."GetPlayerScore(playerid)); 
    
SendClientMessage(playerid,COLOR_GREEN,string); 
    return 
1;

Edit: You forgot to add 'return 1;'
Reply
#3

EDIT: sorry for that, didn't reload the page

Try this:

PHP код:

CMD
:score(playerid

    new 
string[23]; 
    
format(string,sizeof(string),"You Score Is : %d.",GetPlayerScore(playerid)); 
    
SendClientMessage(playerid,COLOR_GREEN,string);
    return 
1;

Reply
#4

Hmm i need an explain for this please and thanks.
Reply
#5

Quote:
Originally Posted by aymane123
Посмотреть сообщение
Hmm i need an explain for this please and thanks.
Quote:
Originally Posted by Eoussama
Посмотреть сообщение
EDIT: sorry for that, didn't reload the page

Try this:
PHP код:
//Method 1:
CMD:score(playerid

    new 
string[23];
    
format(string,sizeof(string),"You Score Is : %d.",GetPlayerScore(playerid)); //The '%d' cpoesifire will be replaces by whoever the GetPlayerScore Function returns, which obviousely going to be the player's score,
    
SendClientMessage(playerid,COLOR_GREEN,string); //This will display the message above in green to the player who typed the commands
    
return 1;

//Method 2:
CMD:score(playerid

    new 
string[23], score GetPlayerScore(playerid);
    
format(string,sizeof(string),"You Score Is : %d.",score); //The '%d' cpoesifire will be replaces by whoever the GetPlayerScore Function returns, which obviousely going to be the player's score,
    
SendClientMessage(playerid,COLOR_GREEN,string); //This will display the message above in green to the player who typed the commands
    
return 1;

Reply
#6

You have to add 'return 1;' so the server knows that it was a valid command.

And for your formatted text, it would return score '0', because you didn't assign a value to the variable 'score'.
Reply
#7

Thx Everyone.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)