What's Wrong with makeleader
#1

Код:
	if(strcmp(cmd, "/makeleader", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "用法: /makeleader [玩家ID] [编号(1-16)]");
				return 1;
			}
			new para1;
			new level;
			para1 = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			level = strval(tmp);
			if(level > 16 || level < 0) { SendClientMessage(playerid, COLOR_WHITE, "* 编号只有0-16!");
			return 1;
			}
			if (PlayerInfo[playerid][pAdm] >= 0)
			{
			    if(IsPlayerConnected(para1))
			    {
			        if(para1 != INVALID_PLAYER_ID)
			        {
			            if(PlayerInfo[para1][pMember] > 0 || PlayerInfo[para1][pFMember] < 255)
			            {
			                SendClientMessage(playerid, COLOR_GREY, "** 这个玩家是家族成员!不能成为组织领导");
			                return 1;
			            }
						GetPlayerName(para1, giveplayer, sizeof(giveplayer));
						PlayerInfo[para1][pLeader] = level;
						format(string, sizeof(string), "* 你已经晋升为组织领导人 %d 设置GM为 %s",level, sendername);
						SendClientMessage(para1, TEAM_GROVE_COLOR, string);
						format(string, sizeof(string), "* 你给了 %s 组织领导人 %d.", giveplayer,level);
						SendClientMessage(playerid, COLOR_ORANGE, string);
	            		format(string, sizeof(string), "[管理员]: %s Has Given Control of the Faction %d to %s.",sendername,level,giveplayer);
						ABroadCast(COLOR_LIGHTRED,string, 5);
						new y, m, d;
						new h,mi,s;
						getdate(y,m,d);
						gettime(h,mi,s);
						format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Gave The Control of the faction %d to [%s]",d,m,y,h,mi,s,sendername,level,giveplayer);
						LoginLog(string);
						AdminLog(string);
						if(level == 0) { PlayerInfo[para1][pChar] = 0; PlayerInfo[para1][pRank] = 0; gTeam[para1] = 3; PlayerInfo[para1][pTeam] = 0; return 1; }
						else if(level == 1) { PlayerInfo[para1][pChar] = 288; } //Police Force
						else if(level == 2) { PlayerInfo[para1][pChar] = 286; } //FBI/ATF
						else if(level == 3) { PlayerInfo[para1][pChar] = 287; } //National Guard
						else if(level == 4) { PlayerInfo[para1][pChar] = 274; } //Ambulance
						else if(level == 5) { PlayerInfo[para1][pChar] = 175; } //Surenos
						else if(level == 6) { PlayerInfo[para1][pChar] = 187; } //La Famiglia Sinatra
						else if(level == 7) { PlayerInfo[para1][pChar] = 147; } //Mayor
						else if(level == 8) { PlayerInfo[para1][pChar] = 20; } //Hitmans
						else if(level == 9) { PlayerInfo[para1][pChar] = 227; } //News Reporters
						else if(level == 10) { PlayerInfo[para1][pChar] = 61; } //Taxi Cab Company
						else if(level == 11) { PlayerInfo[para1][pChar] = 171; } //Driving/Flying School
						else if(level == 12) { PlayerInfo[para1][pChar] = 279; } //Firemen
						else if(level == 14) { PlayerInfo[para1][pChar] = 294; } //Yamaguchi
						else if(level == 15) { PlayerInfo[para1][pChar] = 269; } //Chornaya Bratva
						else if(level == 16) { PlayerInfo[para1][pChar] = 228; } //La Vice

						if(level == 0)
						{
						    gTeam[para1] = 3;
					    	PlayerInfo[para1][pTeam] = 3;
						}
						else if(level == 1)
						{
						    gTeam[para1] = 2;
					    	PlayerInfo[para1][pTeam] = 2;
					    	PlayerInfo[para1][pRank] = 8;
						}
						else if(level == 2)
						{
						    gTeam[para1] = 2;
					    	PlayerInfo[para1][pTeam] = 2;
					    	PlayerInfo[para1][pRank] = 8;
						}
						else if(level == 3)
						{
						    gTeam[para1] = 2;
					    	PlayerInfo[para1][pTeam] = 2;
					    	PlayerInfo[para1][pRank] = 8;
						}
						else if(level == 4)
						{
						    gTeam[para1] = 1;
						    PlayerInfo[para1][pTeam] = 1;
						}
						else
						{
					    	gTeam[para1] = 15;
					    	PlayerInfo[para1][pTeam] = 15;
						}

					    SetPlayerSkin(para1, PlayerInfo[para1][pChar]);

					    if(level == 0)
					    {
					        PlayerInfo[para1][pRank] = 0;
					    }
					    else
					    {
					    	PlayerInfo[para1][pRank] = 8;
						}
					}
				}//not connected
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "  你没有权利使用该指令");
			}
		}
		return 1;
	}
C:\UsaLife.pwn(551) : warning 217: loose indentation
C:\UsaLife.pwn(563) : error 017: undefined symbol "tmp"
C:\UsaLife.pwn(564) : error 017: undefined symbol "tmp"
C:\UsaLife.pwn(571) : error 017: undefined symbol "ReturnUser"
C:\UsaLife.pwn(572) : error 017: undefined symbol "tmp"
C:\UsaLife.pwn(573) : error 017: undefined symbol "tmp"
Reply
#2

looks like there is an extra brace after the second 'return 1;'

edit: the indentation is horrible, so im not sure anymore.

regardless, the compiler is suggesting there is an un-even number of braces, or the indentation is wrong.
Reply
#3

Код:
C:\UsaLife.pwn(551) : warning 217: loose indentation
Check if } or { isn't same as the opposite.
Код:
C:\UsaLife.pwn(563) : error 017: undefined symbol "tmp"
If make this, I am not sure if you still don't get errors
pawn Код:
new tmp
Reply
#4

pawn Код:
new tmp[128];
https://sampforum.blast.hk/showthread.php?tid=91446
Reply
#5

Quote:
Originally Posted by Jafet_Macario
Посмотреть сообщение
every thinks!
but i have a new problem
C:\UsaLife.pwn(571) : error 017: undefined symbol "ReturnUser"
C:\UsaLife.pwn(575) : warning 217: loose indentation
C:\UsaLife.pwn(577) : error 017: undefined symbol "PlayerInfo"
Reply
#6

I think the problem may be here, the compiler did not read the return as within the braces
pawn Код:
if(PlayerInfo[para1][pMember] > 0 || PlayerInfo[para1][pFMember] < 255)
{
    SendClientMessage(playerid, COLOR_GREY, "** ?????????!????????");
    return 1;
}
Reply
#7

Quote:
Originally Posted by Rachael
Посмотреть сообщение
I think the problem may be here, the compiler did not read the return as within the braces
pawn Код:
if(PlayerInfo[para1][pMember] > 0 || PlayerInfo[para1][pFMember] < 255)
{
    SendClientMessage(playerid, COLOR_GREY, "** ?????????!????????");
    return 1;
}
thx i fix it
i just add a include....
Reply
#8

add
Код:
#define tabsize 0
then you won't meet 'loose indentation' problem anymore.
Reply
#9

Quote:
Originally Posted by BANK
Посмотреть сообщение
add
Код:
#define tabsize 0
then you won't meet 'loose indentation' problem anymore.
NO, NO, NO, NO!!!! That's a bad way to avoid warnings. He just need to learn how to use tabs. It's not that hard.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)