Promotion and Demotion help -
HydraX - 01.08.2012
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." );
PlayerInfo[TargetID][pAdmin] = tLevel;
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 );
}
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;
}
So it's pretty basic. However my problem is that whenever I promote someone to let say level 5 when the TargetID is a level 4, it will display, "Player was demoted", Instead it should say "Player was promoted".
Help?
Re: Promotion and Demotion help -
Roko_foko - 01.08.2012
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." );
PlayerInfo[TargetID][pAdmin] = tLevel;//<<<<<<<<<<<<<<<<<<<<Just put this line at the end of the function
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 );
//<<<<<<<<<<<<<<<<<<<<<<here
}
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;
}
Respuesta: Re: Promotion and Demotion help -
HydraX - 01.08.2012
Didn't work, same result.
Re: Promotion and Demotion help -
Roko_foko - 01.08.2012
This is what i ment:
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;
PS: is it vip or admin level?
Respuesta: Re: Promotion and Demotion help -
HydraX - 01.08.2012
Yes, I did that..same result.
PS: Admin. I just copied over the same system because I wanted to test another level system..
EDIT: Ugh, I got a brain fart..I see what you meant at first, but I didn't realize and forgot to remove the Level Variable uptop.
Thanks!