SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 09/04/2014, 06:24 PM   #1
JackieJ
Big Clucker
 
Join Date: Feb 2014
Location: San Andreas :)
Posts: 102
Reputation: 3
Default i need help with /admins!

Script line:
HTML Code:
CMD:admins(playerid, params[])
{
   new sendername[MAX_PLAYER_NAME],string[64 + MAX_PLAYER_NAME];
   for(new i = 0; i < MAX_PLAYERS; i++)
   {
      if(IsPlayerConnected(i))
	  {
		 if(IsPlayerAdmin(i))
                {
		   GetPlayerName(i, sendername, sizeof(sendername));
		   format(string, 100, "Online Admins: %i", IsPlayerAdmin(i));
		   SendClientMessage, COLOR_GREEN, string);
                }
         }
  }
  return 1;
}
Errors:
HTML Code:
C:\Users\Jacob\Desktop\Roleplay Base Script\gamemodes\hrp.pwn(869) : warning 217: loose indentation
C:\Users\Jacob\Desktop\Roleplay Base Script\gamemodes\hrp.pwn(1017) : warning 204: symbol is assigned a value that is never used: "rand"
C:\Users\Jacob\Desktop\Roleplay Base Script\gamemodes\hrp.pwn(1387) : error 076: syntax error in the expression, or invalid function call
C:\Users\Jacob\Desktop\Roleplay Base Script\gamemodes\hrp.pwn(1387) : error 029: invalid expression, assumed zero
C:\Users\Jacob\Desktop\Roleplay Base Script\gamemodes\hrp.pwn(1387) : warning 215: expression has no effect
C:\Users\Jacob\Desktop\Roleplay Base Script\gamemodes\hrp.pwn(1391) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
JackieJ is offline   Reply With Quote
Old 09/04/2014, 06:29 PM   #2
arakuta
High-roller
 
arakuta's Avatar
 
Join Date: Jan 2011
Location: Itajaí - Brazil
Posts: 2,182
Reputation: 184
Default Re: i need help with /admins!

The errors aren't just on /admins...

This is the correct way to use a function.

pawn Code:
SendClientMessage(i,COLOR_GREEN, string);

You did this:

pawn Code:
SendClientMessage, COLOR_GREEN, string);
arakuta is offline   Reply With Quote
Old 09/04/2014, 06:30 PM   #3
JackieJ
Big Clucker
 
Join Date: Feb 2014
Location: San Andreas :)
Posts: 102
Reputation: 3
Default Re: i need help with /admins!

I know

Im just a beginner did this command self
JackieJ is offline   Reply With Quote
Old 09/04/2014, 06:32 PM   #4
Stanford
Gangsta
 
Stanford's Avatar
 
Join Date: Feb 2012
Posts: 983
Reputation: 84
Default Re: i need help with /admins!

The string should be something like this:-
(according to your getplayername)

pawn Code:
format(string, 128, "Online Admins: %s", sendername);
__________________
******: "That code compiles perfectly, but I can tell you now it won't make me a cup of tea."

******: "I've said this before. People think that MySQL is some simple plug-and-play magic bullet that you can use to just make your mode instantly better. They don't realise that the "L" in "SQL" means "language". So instead of programming PAWN, and using a bit of this mystery thing, you are now programming in two languages at once. If you spend months learning PAWN, you should spend the same time learning SQL, if not more - it is probably the more complex of the two languages, and not something that just gets bolted on to the side."
Stanford is offline   Reply With Quote
Old 09/04/2014, 06:33 PM   #5
JackieJ
Big Clucker
 
Join Date: Feb 2014
Location: San Andreas :)
Posts: 102
Reputation: 3
Default Re: i need help with /admins!

I got this error
HTML Code:
C:\Users\Jacob\Desktop\Roleplay Base Script\gamemodes\hrp.pwn(869) : warning 217: loose indentation
C:\Users\Jacob\Desktop\Roleplay Base Script\gamemodes\hrp.pwn(1017) : warning 204: symbol is assigned a value that is never used: "rand"
C:\Users\Jacob\Desktop\Roleplay Base Script\gamemodes\hrp.pwn(1388) : error 001: expected token: ";", but found "}"
C:\Users\Jacob\Desktop\Roleplay Base Script\gamemodes\hrp.pwn(1391) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
JackieJ is offline   Reply With Quote
Old 09/04/2014, 06:34 PM   #6
Bingo
High-roller
 
Bingo's Avatar
 
Join Date: Jul 2012
Location: United Arab Emirates.
Posts: 1,690
Reputation: 238
Default Re: i need help with /admins!

Quote:
Originally Posted by JackieJ View Post
I know

Im just a beginner did this command self
Yes, It shows.

OFFTOPIC:-

Anyway when you learn scripting make sure, Every parameter is placed correctly if you have any doubts just ****** your function .

Small parameters mistake is also noted as well as Pawno is case-sensitive.
__________________
Host SAMP with Evolution-Host

Bingo is offline   Reply With Quote
Old 09/04/2014, 06:35 PM   #7
JackieJ
Big Clucker
 
Join Date: Feb 2014
Location: San Andreas :)
Posts: 102
Reputation: 3
Default Re: i need help with /admins!

How can i fix this one?
Quote:
C:\Users\Jacob\Desktop\Roleplay Base Script\gamemodes\hrp.pwn(869) : warning 217: loose indentation
C:\Users\Jacob\Desktop\Roleplay Base Script\gamemodes\hrp.pwn(1017) : warning 204: symbol is assigned a value that is never used: "rand"
C:\Users\Jacob\Desktop\Roleplay Base Script\gamemodes\hrp.pwn(138 : error 001: expected token: ";", but found "}"
C:\Users\Jacob\Desktop\Roleplay Base Script\gamemodes\hrp.pwn(1391) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
JackieJ is offline   Reply With Quote
Old 09/04/2014, 06:37 PM   #8
Dignity
High-roller
 
Dignity's Avatar
 
Join Date: May 2013
Location: Belgium
Posts: 1,661
Reputation: 1211
Default Re: i need help with /admins!

We can't fix it if you don't show us your code.
Dignity is offline   Reply With Quote
Old 09/04/2014, 06:39 PM   #9
JackieJ
Big Clucker
 
Join Date: Feb 2014
Location: San Andreas :)
Posts: 102
Reputation: 3
Default Re: i need help with /admins!

HTML Code:
CMD:admins(playerid, params[])
{
   new sendername[MAX_PLAYER_NAME],string[64 + MAX_PLAYER_NAME];
   for(new i = 0; i < MAX_PLAYERS; i++)
   {
      if(IsPlayerConnected(i))
	  {
		 if(IsPlayerAdmin(i))
                {
		   GetPlayerName(i, sendername, sizeof(sendername));
		   format(string, 100, "Online Admins: %i", IsPlayerAdmin(i));
		   SendClientMessage, COLOR_GREEN, string);
                }
         }
  }
  return 1;
}
JackieJ is offline   Reply With Quote
Old 09/04/2014, 06:43 PM   #10
Dignity
High-roller
 
Dignity's Avatar
 
Join Date: May 2013
Location: Belgium
Posts: 1,661
Reputation: 1211
Default Re: i need help with /admins!

EDIT:

Quote:
Originally Posted by arakuta View Post
This is the correct way to use a function.

pawn Code:
SendClientMessage(i,COLOR_GREEN, string);

You did this:

pawn Code:
SendClientMessage, COLOR_GREEN, string);
Quote:
Originally Posted by Stanford View Post
The string should be something like this:-
(according to your getplayername)

pawn Code:
format(string, 128, "Online Admins: %s", sendername);

Exactly what arakuta and Standford said.

Fixed code:
pawn Code:
CMD:admins(playerid, params[])
{
    new sendername[MAX_PLAYER_NAME],string[64 + MAX_PLAYER_NAME];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerAdmin(i))
            {
                GetPlayerName(i, sendername, sizeof(sendername));
                format(string, 100, "Online Admins: %s", sendername);
                SendClientMessage(playerid, COLOR_GREEN, string);
            }
        }
    }
    return 1;
}

Last edited by Dignity; 10/04/2014 at 07:52 AM.
Dignity is offline   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


Similar Threads
Thread Thread Starter Forum Replies Last Post
PlayerPlaySound to admins when new report is up. and level 4 admins can read it only zrelly Scripting Help 12 07/09/2013 09:26 AM
/admins dialog Total online admins do help:( y@sin1 Scripting Help 10 14/01/2012 03:58 PM
[HELP]/admins <Show current admins online by ID, Name, Rank and Duty> Deal-or-die Help Archive 7 01/06/2011 11:00 AM
How do I make level 1 admins secret from /admins seanny Help Archive 4 27/05/2011 08:00 AM


All times are GMT. The time now is 08:51 PM.


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