i need help with /admins!
#1

Script line:
Код HTML:
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:
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 © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#2

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

This is the correct way to use a function.

pawn Код:
SendClientMessage(i,COLOR_GREEN, string);
You did this:

pawn Код:
SendClientMessage, COLOR_GREEN, string);
Reply
#3

I know

Im just a beginner did this command self
Reply
#4

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

pawn Код:
format(string, 128, "Online Admins: %s", sendername);
Reply
#5

I got this error
Код HTML:
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 © 1997-2006, ITB CompuPhase


1 Error.
Reply
#6

Quote:
Originally Posted by JackieJ
Посмотреть сообщение
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.
Reply
#7

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 © 1997-2006, ITB CompuPhase


1 Error.

Reply
#8

We can't fix it if you don't show us your code.
Reply
#9

Код HTML:
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;
}
Reply
#10

EDIT:

Quote:
Originally Posted by arakuta
Посмотреть сообщение
This is the correct way to use a function.

pawn Код:
SendClientMessage(i,COLOR_GREEN, string);
You did this:

pawn Код:
SendClientMessage, COLOR_GREEN, string);
Quote:
Originally Posted by Stanford
Посмотреть сообщение
The string should be something like this:-
(according to your getplayername)

pawn Код:
format(string, 128, "Online Admins: %s", sendername);
Exactly what arakuta and Standford said.

Fixed code:
pawn Код:
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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)