SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 29/07/2018, 12:19 AM   #1
RarKiiNG
Little Clucker
 
Join Date: Nov 2017
Posts: 7
Reputation: 0
Default Help

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.
RarKiiNG is offline   Reply With Quote
Old 29/07/2018, 03:03 AM   #2
Leaky
Big Clucker
 
Join Date: Jul 2018
Posts: 81
Reputation: 12
Default Re: Help

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
Leaky is offline   Reply With Quote
Old 29/07/2018, 05:33 AM   #3
coool
Gangsta
 
coool's Avatar
 
Join Date: Feb 2013
Location: Republic of Pakistan
Posts: 634
Reputation: 64
Default Re: Help

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.
__________________
coool is online now   Reply With Quote
Reply

Thread Tools
Display Modes

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



All times are GMT. The time now is 07:48 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.