01.08.2012, 07:46
This is what i ment:
PS: is it vip or admin level?
pawn Код:
YCMD:setadmin(playerid, params[])
{
if( PlayerInfo[playerid][pAdmin] >= 4 )
{
new
TargetID,
tLevel,
tReason[50];
if( !sscanf(params, "uiS(No reason specified)[50]", TargetID, tLevel, tReason) )
{
if( tLevel > 6 ) return SendClientMessage( playerid, -1, ""COL_ORANGE"Maximum level a admin can be: 6" );
if( strlen( tReason ) > 50 ) return SendClientMessage( playerid, -1, ""COL_ORANGE"Maximum Chars for reason: 50" );
if( TargetID == INVALID_PLAYER_ID ) return SendClientMessage( playerid, -1, ""COL_ORANGE"No player is has this Identification number. Please try again." );
new
MyString[128],
TargetString[128];
if( PlayerInfo[TargetID][pAdmin] < tLevel )
{
format( MyString, sizeof MyString, ""COL_ORANGE"You promoted %s to vip level %i. Reason: %s", GetName(TargetID), tLevel, tReason );
format( TargetString, sizeof TargetString, ""COL_ORANGE"You have been promoted by %s to vip level %i. Reason: %s", GetName(playerid), tLevel, tReason );
SendClientMessage( TargetID, -1, TargetString );
}
else
{
format( MyString, sizeof MyString, ""COL_ORANGE"You demoted %s to vip level %i. Reason: %s", GetName(TargetID), tLevel, tReason );
format( TargetString, sizeof TargetString, ""COL_ORANGE"You have been demoted by %s to vip level %i. Reason: %s", GetName(playerid), tLevel, tReason );
SendClientMessage( TargetID, -1, TargetString );
}
SendClientMessage( playerid, -1, MyString );
PlayerInfo[TargetID][pAdmin] = tLevel;
}
else
return SendClientMessage( playerid, -1, ""COL_ORANGE"Usage: /setvip <TargetID> <Level> <(OPTIONAL)Reason>" );
}
else
return SendClientMessage( playerid, -1, ""COL_ORANGE"You have to be an admin to perform this command!" );
return 1;