Please check this code out for me please
#1

Код:
CMD:setadmin(playerid,params[])
{
		new id,level;
	if(IsPlayerAdmin(playerid))
	{
	    if(sscanf(params,"ud",id,level) return SendClientMessage(playerid, COL_RED, "Usage: /setadmin [id] [level] ");
		else
		{
		    if(level > 5) return SendClientMessage(playerid, COL_RED, "Usage: /setadmin id 1-5");
		    else
		    {
					new INI:File = INI_Open(UserPath(id));
					INI_WriteInt(File,"Admin",level);
					INI_Close(File);
			}
		}
	}
	else
	{
	SendClientMessage(playerid, COL_RED, "That id is not connected");
	}
}
and can you tell me what i did wrong. explain to me what i did wrong so i can correct it in the future
Reply
#2

You should use an pAdmin in your player data enum
It's way easier too use instead of opening their file and writing the admin level.
Reply
#3

hey i notice my error are on the each lines that have SendClientMessage

Код:
C:\Users\score_000\Desktop\Server\gamemodes\Unoffical.pwn(330) : error 001: expected token: ")", but found "return"
C:\Users\score_000\Desktop\Server\gamemodes\Unoffical.pwn(330) : error 035: argument type mismatch (argument 2)
C:\Users\score_000\Desktop\Server\gamemodes\Unoffical.pwn(333) : error 035: argument type mismatch (argument 2)
C:\Users\score_000\Desktop\Server\gamemodes\Unoffical.pwn(344) : error 035: argument type mismatch (argument 2)
C:\Users\score_000\Desktop\Server\gamemodes\Unoffical.pwn(346) : warning 209: function "cmd_setadmin" should return a value
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#4

anyone
Reply
#5

pawn Код:
if(sscanf(params,"ud",id,level)) return // blabla..
It needs two parentheses.
Reply
#6

Код:
CMD:setadmin(playerid,params[])
{
	new id,level;
	if(IsPlayerAdmin(playerid))
	{
	    if(sscanf(params,"ud",id,level))
		{
	        return SendClientMessage(playerid, 0xFF0000AA, "Usage: /givecash <playerid/name> <amount>");
		}
		else
		{
		    if(level > 5)) return test(playerid);
			}
		    else
		    {
					new INI:File = INI_Open(UserPath(id));
					INI_WriteInt(File,"Admin",level);
					INI_Close(File);
			}
		}
	}
	else
	{
	SendClientMessage(playerid, COL_RED, "That id is not connected");
	}
}
ok this what i did but i am getting error
Код:
 if(level > 5)) return test(playerid);
Reply
#7

Not that, the line I posted.

Quote:
Originally Posted by _Zeus
Посмотреть сообщение
pawn Код:
if(sscanf(params,"ud",id,level)) return // blabla..
It needs two parentheses.
Reply
#8

Quote:
Originally Posted by _Zeus
Посмотреть сообщение
Not that, the line I posted.
Do this just correct the code for me so i can see this cause am getting confuse
Код:
CMD:setadmin(playerid,params[])
{
	new id,level;
	if(IsPlayerAdmin(playerid))
	{
	    if(sscanf(params,"ud",id,level))
		{
	        return SendClientMessage(playerid, 0xFF0000AA, "Usage: /givecash <playerid/name> <amount>");
		}
		else
		{
		    if(level > 5) return error
			}
		    else
		    {
					new INI:File = INI_Open(UserPath(id));
					INI_WriteInt(File,"Admin",level);
					INI_Close(File);
			}
		}
 }
 else
 {
	SendClientMessage(playerid, COL_RED, "That id is not connected");
	}
}
Код:
C:\Users\score_000\Desktop\Server\gamemodes\Unoffical.pwn(337) : error 017: undefined symbol "error"
C:\Users\score_000\Desktop\Server\gamemodes\Unoffical.pwn(339) : warning 217: loose indentation
C:\Users\score_000\Desktop\Server\gamemodes\Unoffical.pwn(339) : error 029: invalid expression, assumed zero
C:\Users\score_000\Desktop\Server\gamemodes\Unoffical.pwn(346) : warning 209: function "cmd_setadmin" should return a value
C:\Users\score_000\Desktop\Server\gamemodes\Unoffical.pwn(347) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#9

pawn Код:
CMD:setadmin(playerid,params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new id,level;
        if(sscanf(params,"ud",id,level)) return SendClientMessage(playerid, COL_RED, "Usage: /setadmin [id] [level] ");
        if(level > 5) return SendClientMessage(playerid, COL_RED, "Usage: /setadmin id 1-5");
        new INI:File = INI_Open(UserPath(id));
        INI_WriteInt(File,"Admin",level);
        INI_Close(File);
    }
    else SendClientMessage(playerid, COL_RED, "That id is not connected");
    return 1;
}
Reply
#10

Quote:
Originally Posted by _Zeus
Посмотреть сообщение
pawn Код:
CMD:setadmin(playerid,params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new id,level;
        if(sscanf(params,"ud",id,level)) return SendClientMessage(playerid, COL_RED, "Usage: /setadmin [id] [level] ");
        if(level > 5) return SendClientMessage(playerid, COL_RED, "Usage: /setadmin id 1-5");
        new INI:File = INI_Open(UserPath(id));
        INI_WriteInt(File,"Admin",level);
        INI_Close(File);
    }
    else SendClientMessage(playerid, COL_RED, "That id is not connected");
    return 1;
}
Am done.... i ha that at first but i am getting error
Код:
C:\Users\score_000\Desktop\Server\gamemodes\Unoffical.pwn(331) : error 035: argument type mismatch (argument 2)
C:\Users\score_000\Desktop\Server\gamemodes\Unoffical.pwn(334) : error 035: argument type mismatch (argument 2)
C:\Users\score_000\Desktop\Server\gamemodes\Unoffical.pwn(345) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
am getting that error for all the lines that have sendclient message onto it
and i am sscanf if that helps
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)