set level cmd bmp
#1

Код:
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(122) : warning 201: redefinition of constant/macro (symbol "RED")
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(123) : warning 201: redefinition of constant/macro (symbol "COLOR_BLUE")
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(124) : warning 201: redefinition of constant/macro (symbol "COLOR_WHITE")
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(125) : warning 201: redefinition of constant/macro (symbol "COLOR_PINK")
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(126) : warning 201: redefinition of constant/macro (symbol "COLOR_BROWN")
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(1958) : warning 217: loose indentation
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(1959) : warning 217: loose indentation
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(1969) : warning 217: loose indentation
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(1970) : warning 217: loose indentation
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(2168) : warning 217: loose indentation
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(2481) : warning 217: loose indentation
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(6141) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(6141) : warning 215: expression has no effect
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(6141) : error 017: undefined symbol "level"
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(6141) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(6141) : fatal error 107: too many error messages on one line
Код:
CMD:makeadmin(playerid,params[])
{
	new stat;
	new targetid;
	new string[128];
	new sendername[MAX_PLAYER_NAME];
  	new giveplayer[MAX_PLAYER_NAME];
	GetPlayerName(targetid, giveplayer, sizeof(giveplayer));
	GetPlayerName(playerid, sendername, sizeof(sendername));
	if(sscanf(params, "ui",targetid,stat))
	return SendClientMessage(playerid, RED, "[Database:]{FFFFFF} /makeadmin [playerid] [0-6]");
	if(AccountInfo[playerid][pAdmin] == 0)
	return SendClientMessage(playerid, RED, "[Database:]{FFFFFF} Your not an admin!");
	if(AccountInfo[playerid][pAdmin] < 6)
	return SendClientMessage(playerid, RED, "You need to be a higher admin");
	if(AccountInfo[playerid][pAdmin] == 6)
	{
        switch (stat)
        {
            case 0:
			{
			    AccountInfo[targetid][pAdmin] = 0;
				format(string, sizeof(string), "*"COL_RED" %s %s have given admin status of 0 to %s"(playerid),PlayerName(playerid),level,PlayerName(targetid));
				SendClientMessage(targetid, COLOR_SET, string);
				format(string, sizeof(string), "[Database:]{FFFFFF} You have revoked %s Admin Level", giveplayer);
				SendClientMessage(playerid, RED, string);
			}
			case 1:
			{
				AccountInfo[targetid][pAdmin] = 1;
					format(string, sizeof(string), "*"COL_RED" %s %s have given admin status of 1 to %s"(playerid),PlayerName(playerid),level,PlayerName(targetid));
				SendClientMessage(targetid, COLOR_SET, string);
				format(string, sizeof(string), "[Database:]{FFFFFF} You set %s to a Level: %d Admin", giveplayer,stat);
				SendClientMessage(playerid, RED, string);
			}
			case 2:
			{
				AccountInfo[targetid][pAdmin] = 2;
			    	format(string, sizeof(string), "*"COL_RED" %s %s have given admin status of 2 to %s"(playerid),PlayerName(playerid),level,PlayerName(targetid));
				SendClientMessage(targetid, COLOR_SET, string);
				format(string, sizeof(string), "[Database:]{FFFFFF} You set %s to a Level: %d Admin", giveplayer,stat);
				SendClientMessage(playerid, RED, string);
			}
			case 3:
			{
				AccountInfo[targetid][pAdmin] = 3;
			    	format(string, sizeof(string), "*"COL_RED" %s %s have given admin status of 3 to %s"(playerid),PlayerName(playerid),level,PlayerName(targetid));
				SendClientMessage(targetid, COLOR_SET, string);
				format(string, sizeof(string), "[Database:]{FFFFFF} You set %s to a Level: %d Admin", giveplayer,stat);
				SendClientMessage(playerid, RED, string);
			}
			case 4:
			{
				AccountInfo[targetid][pAdmin] = 4;
					format(string, sizeof(string), "*"COL_RED" %s %s have given admin status of 4 to %s"(playerid),PlayerName(playerid),level,PlayerName(targetid));
				SendClientMessage(targetid, COLOR_SET, string);
				format(string, sizeof(string), "[Database:]{FFFFFF} You set %s to a Level: %d Admin", giveplayer,stat);
				SendClientMessage(playerid, RED, string);
			}
			case 5:
			{
				AccountInfo[targetid][pAdmin] = 5;
			    	format(string, sizeof(string), "*"COL_RED" %s %s have given admin status of 5 to %s"(playerid),PlayerName(playerid),level,PlayerName(targetid));
				SendClientMessage(targetid, COLOR_SET, string);
				format(string, sizeof(string), "[Database:]{FFFFFF} You set %s to a Level: %d Admin", giveplayer,stat);
				SendClientMessage(playerid, RED, string);
			}
			case 6:
			{
				AccountInfo[targetid][pAdmin] = 6;
			    	format(string, sizeof(string), "*"COL_RED" %s %s have given admin status of 6 to %s"(playerid),PlayerName(playerid),level,PlayerName(targetid));
				SendClientMessage(targetid, COLOR_SET, string);
				format(string, sizeof(string), "[Database:]{FFFFFF} You set %s to a Level: %d Admin", giveplayer,stat);
				SendClientMessage(playerid, RED, string);
			}
		}
	}
	return 1;
}
Reply
#2

Код:
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(126) : warning 201: redefinition of constant/macro (symbol "COLOR_BROWN")
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(1964) : warning 217: loose indentation
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(1965) : warning 217: loose indentation
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(1975) : warning 217: loose indentation
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(1976) : warning 217: loose indentation
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(2174) : warning 217: loose indentation
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(2487) : warning 217: loose indentation
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(6130) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(6130) : error 017: undefined symbol "chat"
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(6130) : warning 215: expression has no effect
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(6130) : error 001: expected token: ";", but found ")"
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(6130) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Код:
CMD:setadmin(playerid,params[])
{
    if(AccountInfo[playerid][pAdmin] < 6)
	{
		new targetid,level,string[180];
		if(sscanf(params, "ud", targetid, level)) return  SendClientMessage(playerid,-1,""chat" /setadmin [playerid] [level]");
		if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");
		if(level < 0 || level > 6) return SendClientMessage(playerid,-1,""chat"  Admin levels are ONLY between 1-5");

        AccountInfo[playerid][pAdmin] = level;

		format(string, sizeof(string), "*"COLOR_RED" Community Owner %s have given admin status of %d to %s",GetAdminName(playerid),PlayerName(playerid),level,PlayerName(targetid));
		SendClientMessageToAll(-1,string);
	}
	else {
		SendClientMessage(playerid,-1,"*"COLOR_RED" You do not have the right admin permissions for this command!");
	}
	return 1;
}
Reply
#3

PHP код:
redefinition of constant/macro 
This error occurs when you define something twice, in this case, the colors are already defined and you defined them twice.

PHP код:
warning 217loose indentation 
There is an easy fix for this which is:

Код HTML:
#pragma tabsize 0
it just avoids those warnings, but I wouldn't recommend you to use this, it's better you indent your code properly.

Код HTML:
SendClientMessage(playerid,-1,""chat"  Admin levels are ONLY between 1-5");
And what is ""chat" here? is it color or something?

Код HTML:
format(string, sizeof(string), "*"COLOR_RED" Community Owner %s have given admin status of %d to %s",GetAdminName(playerid),PlayerName(playerid),level,PlayerName(targetid));
isn't should be like this?

Код HTML:
format(string, sizeof(string), "*"COLOR_RED" Community Owner %s have given admin status of %d to %s",GetAdminName(playerid),level,PlayerName(targetid));
I'll to leave it to some experienced scripter, they'll help you better.
Reply
#4

Try This one Too,

CMD:Setadmin(playerid,params[])
{
if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,0xFF9900AA, "Chat: /setadmin [ID] [Level]");
if(levels > 6) return SendClientMessage(playerid,Chat,"Admins level Are Only Between 1-5!");
if(!IsPlayerConnected(ID))return SendClientMessage(playerid,Chat,"The Player Is Not .");
GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);
GetPlayerName(ID,pname,MAX_PLAYER_NAME);
{
format(str, sizeof(str), Community Owner %s have given admin status of %d to %s",GetAdminName(playerid),PlayerName(playerid),le vel,PlayerName(targetid));
SendClientMessage(ID,COLOR_RED,str);
}
else {
SendClientMessage(playerid,-1,"*"COLOR_RED" You do not have the right admin permissions for this command!");
}
return 1;
}
Reply
#5

i try all bump omG

Код:
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(123) : warning 201: redefinition of constant/macro (symbol "RED")
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(124) : warning 201: redefinition of constant/macro (symbol "COLOR_BLUE")
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(125) : warning 201: redefinition of constant/macro (symbol "COLOR_WHITE")
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(126) : warning 201: redefinition of constant/macro (symbol "COLOR_PINK")
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(127) : warning 201: redefinition of constant/macro (symbol "COLOR_BROWN")
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(6137) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(6137) : warning 215: expression has no effect
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(6137) : error 001: expected token: ";", but found "-string-"
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(6137) : warning 215: expression has no effect
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(6137) : error 017: undefined symbol "GetAdminName"
C:\Documents and Settings\Administrateur\Mes documents\GMS\DayZ 9.1\gamemodes\rs.pwn(6137) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#6

Quote:
Originally Posted by BlackbirdXd
Посмотреть сообщение
PHP код:
warning 217loose indentation 
There is an easy fix for this which is:

Код HTML:
#pragma tabsize 0
That's not a fix... That's simply suppressing the error itself.

The fix would be fixing the indentation. If you're that lazy and need an easy lay-about way of doing it, you can simply use uncrustify with
Код:
uncrustify.exe -c ./cfg/defaults.cfg -f fucked.pwn > unfucked.pwn
OP, why have you got "RED" "COL_RED" AND "COLOR_RED"? Are they all different shades of red, or are they simply all the same value?

Should work on that... If anything I'd say you're confusing yourself by having so many defines.
Reply
#7

That's what happens when your gamemode is a mixture of 430 copy-pastes.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)