#1

this is my kick code but given me 2 error and i cant fix it.can you help me?
Код:
CMD:kick(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >=2 || IsPlayerAdmin(playerid))
    {
		new id,reason[64], str[128], adminname[MAX_PLAYER_NAME], victimname[MAX_PLAYER_NAME], kid;
	   	if(sscanf(params, "us[64]", id,reason))return SendClientMessage(playerid, COLOR_RED, "USAGE: /kick [ID] [Reason]");
		if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "[Error]: You can not kicked yourself!");
		if(PlayerInfo[id][pAdmin] >= PlayerInfo[playerid][pAdmin] || IsPlayerAdmin(playerid))return SendClientMessage(playerid, COLOR_RED, "[Error]: You can not kicked higher admins!");
		if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[ERROR]:Invalid ID");
	 	GetPlayerName(playerid, adminname, sizeof(adminname));
		GetPlayerName(kid, victimname, sizeof(victimname));
		if(PlayerInfo[playerid][pKick] ==1)
		{
			format(str, sizeof(str), "[KICK] Admin %s (id:%d) kicked %s (id:%d) from the server.Reason: [1 of 3 kick] %s.", adminname, playerid, victimname, kid, reason);
			SendClientMessageToAll(COLOR_RED, str);
			if(PlayerInfo[playerid][pKick] +=1
			GameTextForPlayer(id, "~r~You have been kicked!", 5000, 4);
			Kick(id);
			return 1;
		}
		if(PlayerInfo[playerid][pKick] ==2)
		{
			format(str, sizeof(str), "[KICK] Admin %s (id:%d) kicked %s (id:%d) from the server.Reason: [2 of 3 kick] %s.", adminname, playerid, victimname, kid, reason);
			SendClientMessageToAll(COLOR_RED, str);
			if(PlayerInfo[playerid][pKick] +=1
			GameTextForPlayer(id, "~r~You have been kicked!", 5000, 4);
			Kick(id);
			return 1;
		}
		if(PlayerInfo[playerid][pKick] ==3)
		{
		    new filestring[79];
			format(filestring, sizeof(filestring), "/Asystem/Users/%s.ini", kid);
			format(str, sizeof(str), "[KICK] Admin %s (id:%d) banned %s (id:%d) from the server.Reason: [3 of 3 kick] %s.", adminname, playerid, victimname, kid, reason);
			SendClientMessageToAll(COLOR_RED, str);
			new INI:File = INI_Open(filestring);
			INI_SetTag(File, "data");
			INI_WriteInt(File, "pBan", 1);
			INI_Close(File);
			GameTextForPlayer(id, "~r~You have been banned!", 5000, 4);
			return 1;
		}
    	return 1;
    }
	else return SendClientMessage(playerid,COLOR_RED,"You do not have permission to use this command!");
}
Код:
C:\Users\Aref\Desktop\Aref\sampserver\pawno\CODv2.pwn(1606) : error 001: expected token: ")", but found "-identifier-"
C:\Users\Aref\Desktop\Aref\sampserver\pawno\CODv2.pwn(1615) : error 001: expected token: ")", but found "-identifier-"
Код:
1606 = GameTextForPlayer(id, "~r~You have been kicked!", 5000, 4);    in player info = 1 kick

1601 = Kick(id);  in player info = 2 kick
Reply
#2

You are using an if stament without comming to a conclusion for it. You don't need an if statement here.
PHP код:
        if(PlayerInfo[playerid][pKick] ==1)
        {
            
format(strsizeof(str), "[KICK] Admin %s (id:%d) kicked %s (id:%d) from the server.Reason: [1 of 3 kick] %s."adminnameplayeridvictimnamekidreason);
            
SendClientMessageToAll(COLOR_REDstr);
        
//if(PlayerInfo[playerid][pKick] +=1
            
GameTextForPlayer(id"~r~You have been kicked!"50004);
            
Kick(id);
            return 
1;
        } 
PHP код:
        if(PlayerInfo[playerid][pKick] ==1)
        {
            
format(strsizeof(str), "[KICK] Admin %s (id:%d) kicked %s (id:%d) from the server.Reason: [1 of 3 kick] %s."adminnameplayeridvictimnamekidreason);
            
SendClientMessageToAll(COLOR_REDstr);
            
PlayerInfo[playerid][pKick] =1;
            
GameTextForPlayer(id"~r~You have been kicked!"50004);
            
Kick(id);
            return 
1;
        } 
Reply
#3

You missed closing bracket :
PHP код:
if(PlayerInfo[playerid][pKick] +=
It should be like :
PHP код:
if(PlayerInfo[playerid][pKick] +=1
But I think it should be like this to make your codes work correctly :
PHP код:
PlayerInfo[playerid][pKick] += 1
Reply
#4

Quote:
Originally Posted by Sh4d0w2
Посмотреть сообщение
You missed closing bracket :
PHP код:
if(PlayerInfo[playerid][pKick] +=
It should be like :
PHP код:
if(PlayerInfo[playerid][pKick] +=1
It is wrong.
He must just do
PlayerInfo[playerid][pKick] = 1;
or
PlayerInfo[playerid][pKick]=+1;
depends on what he wants to do with that variable
EDIT:
Also you did the same error here
PHP код:
        if(PlayerInfo[playerid][pKick] ==2)
        {
            
format(strsizeof(str), "[KICK] Admin %s (id:%d) kicked %s (id:%d) from the server.Reason: [2 of 3 kick] %s."adminnameplayeridvictimnamekidreason);
            
SendClientMessageToAll(COLOR_REDstr);
            if(
PlayerInfo[playerid][pKick] +=1
            GameTextForPlayer
(id"~r~You have been kicked!"50004);
            
Kick(id);
            return 
1;
        } 
Change to
PHP код:
        if(PlayerInfo[playerid][pKick] ==2)
        {
            
format(strsizeof(str), "[KICK] Admin %s (id:%d) kicked %s (id:%d) from the server.Reason: [2 of 3 kick] %s."adminnameplayeridvictimnamekidreason);
            
SendClientMessageToAll(COLOR_REDstr);
            
PlayerInfo[playerid][pKick] =1;
            
GameTextForPlayer(id"~r~You have been kicked!"50004);
            
Kick(id);
            return 
1;
        } 
Reply
#5

If you look to his codes,Im telling the correct one,he missed a bracket.
But to make his code works,he need to follow your solution.
Reply
#6

thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)