#1

Hello, i wanna make a cmd, when i use a command in chat the cmd start to do this:'/id 0'... '/id 1' ... '/id 2' .... '/id 3'....etc ... '/id 999'.
i am new i scripting. please help me.
Reply
#2

what i would do is make a loop through all the players and them make a function which collects the players information that i want to be displayed and send it in the command, in other words somthing like a /admins command with a little more features.

PHP Code:
CMD:admins(playerid)
{
new 
count 0;    
SendClientMessage(playerid0x3776CCFF" Players Information");
    foreach(new 
Player)
    {
string[128];
        
format(stringsizeof(string), "%s "Sendinfo(i));// you will need to edit this line if you dont want to make a function to collect the information and just rather to paste the long code here.
SendClientMessage(playerid,-1,string)        
count ++;
}
    if(
count <= 1)
    {
        
SendClientMessage(playerid,-1,"No Players Online");
    }
    return 
1;

Note that if you use the function "Sendinfo" you will have to create/define it because i didn't make or if you are too lazy to make the function you will have to paste the long code to collect the information in the format line.

Now all you need to do is build the function which is pretty easy to do
Reply
#3

Quote:
Originally Posted by RarKiiNG
View Post
Hello, i wanna make a cmd, when i use a command in chat the cmd start to do this:'/id 0'... '/id 1' ... '/id 2' .... '/id 3'....etc ... '/id 999'.
i am new i scripting. please help me.
I can not understand you. but maybe you are looking about sscanf.
Quote:
Originally Posted by Leaky
View Post
what i would do is make a loop through all the players and them make a function which collects the players information that i want to be displayed and send it in the command, in other words somthing like a /admins command with a little more features.

PHP Code:
CMD:admins(playerid)
{
new 
count 0;    
SendClientMessage(playerid0x3776CCFF" Players Information");
    foreach(new 
Player)
    {
string[128];
        
format(stringsizeof(string), "%s "Sendinfo(i));// you will need to edit this line if you dont want to make a function to collect the information and just rather to paste the long code here.
SendClientMessage(playerid,-1,string)        
count ++;
}
    if(
count <= 1)
    {
        
SendClientMessage(playerid,-1,"No Players Online");
    }
    return 
1;

Note that if you use the function "Sendinfo" you will have to create/define it because i didn't make or if you are too lazy to make the function you will have to paste the long code to collect the information in the format line.

Now all you need to do is build the function which is pretty easy to do
This is completely irrelevant to OP. Instead of creating a variable "count" you can use Iter_count.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)