SA-MP Forums Archive
Dcmd_Warn - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Dcmd_Warn (/showthread.php?tid=200222)



Dcmd_Warn - Tessar - 17.12.2010

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;
}



Re: Dcmd_Warn - blackwave - 17.12.2010

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



Re: Dcmd_Warn - WillyP - 17.12.2010

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
..?


Re: Dcmd_Warn - case 1337: - 17.12.2010

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.


Re: Dcmd_Warn - MestreKiller - 17.12.2010

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



Re: Dcmd_Warn - Tessar - 17.12.2010

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