Author Topic: isConsoleAdmin  (Read 1342 times)

I made this to grant use to eval. But it doesn't work and i don't see the problem.
Code: [Select]
function servercmdGiveConsoleAdmin(%Client, %Victim, %Number)
{
if(%Client.isSuperAdmin && %client.isConsoleAdmin)
{
if(%victim.getname() !$= " " || %victim.getname() !$= "")
{
%ClanTemp = %Victim.clanSuffix;
if(%Number = 1)
{
%Victim.isConsoleAdmin = 1;
%Victim.clanSuffix = "\c6[\c4CA\c6]";
messageClient(%victim,'MsgAdminFoce',"\c2You have been given \c4Console Admin\c2 by \c3" @ %client.name() @ "\c4.");
messageClient(%Client,'MsgAdminFoce',"\c2You have given \c4Console Admin\c2 to \c3" @ %victim.name() @ "\c4.");
}
else
{
if(%Number = 0)
{
%Victim.isConsoleAdmin = 0;
%Victim.clanSuffix = %ClanTemp;
messageclient(%victim,'MsgAdminFoce',"\c5You have gotton \c4Console Admin\c2 removed by \c3" @ %client.name() @ "\c5.");
messageClient(%Client,'MsgAdminFoce',"\c2You have removed \c4Console Admin\c2 from \c3" @ %victim.name() @ "\c4.");

}
else
{
messageclient(%client,'',"You must put in a number 1 for True and 0 for False.");
}
}
}
else
{
messageclient(%client,'',"You must put a valid player name.");
}
}
else
{
messageclient(%client,'',"You must be Super Admin and Console Admin to use this command");
}
}

== is for comparison, = is for assignment.

== is for comparison, = is for assignment.
Oh damnit i always do that.
Now the victim name check part is the only one that doesnt work.
« Last Edit: July 04, 2009, 12:02:41 PM by Plornt »

You did it wrong.
if(%victim.getname() !$= " " || %victim.getname() !$= "")
Get rid of the .getName()s on those.

Just after the next {
do %victim = findClientByName(%victim);

If i dont enter a name it will remove it from me. This is what i have
Code: [Select]
function servercmdGiveConsoleAdmin(%Client, %Victim, %Number)
{
if(%Client.isSuperAdmin && %client.isConsoleAdmin)
{
if(%victim !$= " " || %victim !$= "" || %victim !$= "Plornt")
{
%victim = findClientByName(%victim);
$ClanT[%victim.BL_ID] = %victim.ClanSuffix;
if(%Number == 1)
{
if(%victim.isconsoleadmin == 0)
{
%Victim.isConsoleAdmin = 1;
%Victim.clanSuffix = "\c6[\c4CA\c6]";
messageClient(%victim,'MsgAdminFoce',"\c2You have been given \c4Console Admin\c2 by \c3" @ %client.name @ "\c2.");
messageClient(%Client,'MsgAdminFoce',"\c2You have given \c4Console Admin\c2 to \c3" @ %victim.name @ "\c2.");
}
else
{
messageClient(%Client,'MsgAdminFoce',"This player is already Console Admin.");
}
}
else
{
if(%Number == 0)
{
if(%victim.isconsoleadmin == 1)
{
%Victim.isConsoleAdmin = 0;
%Victim.clanSuffix = $clanT[%victim.BL_ID];
messageclient(%victim,'MsgAdminFoce',"\c2You have gotton \c4Console Admin\c2 removed by \c3" @ %client.name @ "\c5.");
messageClient(%Client,'MsgAdminFoce',"\c2You have removed \c4Console Admin\c2 from \c3" @ %victim.name @ "\c4.");
}
else
{
messageClient(%Client,'MsgAdminFoce',"This player is not Console Admin.");

}
else
{
messageclient(%client,'',"You must put the player's name and 1 for True or 0 for false.");
}
}
}
else
{
messageclient(%client,'',"You must put a valid player name.");
}
}
else
{
messageclient(%client,'',"You must be Super Admin and Console Admin to use this command");
}
}

Right after %victim = findClient... , try
Code: [Select]
if(%victim.isLocalClient())
{
messageClient(%client,'',"You cannot change rights of the host.");
return;
}

Unable to find islocalclient.

Unable to find islocalclient.
That's a variable of a client, the local client is localClientConnection and is the only client that will return true for isLocalClient.

That's a variable of a client, the local client is localClientConnection and is the only client that will return true for isLocalClient.
Exactly it didn't work.

Okay, replace that with %victim != getLocalClient()

So...
Code: [Select]
if(%victim != getLocalClient())
{
messageClient(%client,'',"You cannot change rights of the host.");
return;
}
 
 
 


Now it thinks every victim is host and unable to find getLocalClient. One last question what would i add to make it check if the victim is a valid player.
« Last Edit: July 08, 2009, 03:08:08 PM by Plornt »


Code: [Select]
function servercmdGiveConsoleAdmin(%Client, %Victim, %Number)
{
if(%Client.isSuperAdmin && %client.isConsoleAdmin)
{
%victim = findClientByName(%victim);
if(%victim !$= "" || %victim.getPlayerName() !$= "" || %victim.getPlayerName() $= "Plornt")
{
messageclient(%client,'',"You must put a valid player name.");
return;
}
$ClanT[%victim.BL_ID] = %victim.ClanSuffix;
if(%Number == 1)
{
if(%victim.isconsoleadmin == 0)
{
%Victim.isConsoleAdmin = 1;
%Victim.clanSuffix = "\c6[\c4CA\c6]";
messageClient(%victim,'MsgAdminFoce',"\c2You have been given \c4Console Admin\c2 by \c3" @ %client.name @ "\c2.");
messageClient(%Client,'MsgAdminFoce',"\c2You have given \c4Console Admin\c2 to \c3" @ %victim.name @ "\c2.");
}
else
{
messageClient(%Client,'MsgAdminFoce',"This player is already Console Admin.");
}
}
else
{
if(%Number == 0)
{
if(%victim.isconsoleadmin == 1)
{
%Victim.isConsoleAdmin = 0;
%Victim.clanSuffix = $clanT[%victim.BL_ID];
messageclient(%victim,'MsgAdminFoce',"\c2You have gotton \c4Console Admin\c2 removed by \c3" @ %client.name @ "\c5.");
messageClient(%Client,'MsgAdminFoce',"\c2You have removed \c4Console Admin\c2 from \c3" @ %victim.name @ "\c4.");
}
else
{
messageClient(%Client,'MsgAdminFoce',"This player is not Console Admin.");

}
else
{
messageclient(%client,'',"You must put the player's name and 1 for True or 0 for false.");
}
}
}
else
{
messageClient(%client,'',"You must be Super Admin and Console Admin to do that.");
}
}
I think that should do it, but my browser screws up with long messages and I really can't see my messages well.

I basically just changed the structure and fixed some code issues such as the second if.
« Last Edit: July 10, 2009, 10:35:49 PM by Slicksilver555 »