Dcmd_Warn
#1

Hey,
Ive made a /warn command but when i type /warn [id] nothing comes up =/

Код:
dcmd_warn(playerid, params[])
{
	new warnID;
	if(PlayerInfo[playerid][AdminLevel] < 1)
    if(sscanf(params, "u", warnID))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /warn [playerid]");
    else
    {
		new String[22];
		SetPVarInt(warnID, "Warned", GetPVarInt(playerid, "Warned")+1);
		format(String, sizeof(String), "ADMIN WARNING! [%i/5]", GetPVarInt(playerid, "Warned"));
		SendClientMessage(warnID, COLOR_RED, String);

		if(GetPVarInt(playerid, "Warned")>=5)Kick(warnID);
	}
	return 1;
}
Reply
#2

pawn Код:
if(PlayerInfo[playerid][AdminLevel] < 1) return false
Reply
#3

pawn Код:
dcmd_warn(playerid, params[])
{
    new warnID;
    if(PlayerInfo[playerid][AdminLevel] > 1)
    if(sscanf(params, "u", warnID))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /warn [playerid]");
    else
    {
        new String[22];
        SetPVarInt(warnID, "Warned", GetPVarInt(playerid, "Warned")+1);
        format(String, sizeof(String), "ADMIN WARNING! [%i/5]", GetPVarInt(playerid, "Warned"));
        SendClientMessage(warnID, COLOR_RED, String);

        if(GetPVarInt(playerid, "Warned")>=5)Kick(warnID);
    }
    return 1;
}

Quote:
Originally Posted by blackwave
Посмотреть сообщение
pawn Код:
if(PlayerInfo[playerid][AdminLevel] < 1) return false
..?
Reply
#4

pawn Код:
dcmd_warn(playerid, params[])
{
    new warnID;
    if(PlayerInfo[playerid][AdminLevel] < 1) return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Unknown command.");
    if(sscanf(params, "u", warnID))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /warn [playerid]");
    else
    {
        new String[22];
        SetPVarInt(warnID, "Warned", GetPVarInt(playerid, "Warned")+1);
        format(String, sizeof(String), "ADMIN WARNING! [%i/5]", GetPVarInt(playerid, "Warned"));
        SendClientMessage(warnID, COLOR_RED, String);

        if(GetPVarInt(playerid, "Warned")>=5) return Kick(warnID);
    }
    return 1;
}
Quote:
Originally Posted by blackwave
Посмотреть сообщение
pawn Код:
if(PlayerInfo[playerid][AdminLevel] < 1) return false
Quote:
Originally Posted by [OC]MestreKiller
Посмотреть сообщение
pawn Код:
if(PlayerInfo[playerid][AdminLevel] < 1) return 0
That's just gonna pop up with "SERVER: Unknown command.", I suggest you learn more/learn about returning false.
Reply
#5

pawn Код:
if(PlayerInfo[playerid][AdminLevel] < 1) return 0
Reply
#6

Thanks all for helping. This now works <3 <3 <3
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)