Author Topic: Why won't this work?  (Read 533 times)

Ok, I'm new to this scripting thing, and I wanted to do a simple mod that could change your clan tags when you typed /changetags [blid] [tags1] [tags2].

This is what I did.

Code: [Select]
function serverCmdchangetags(%admin, %blid, %clanprefix, %clansuffix)
{
    if(!%admin.issuperadmin) return;

%target = getclientbyid(%blid);

if(target == -1) return;

$ClanTagsSet[%blid] = true;

messageall("\c1 " @ %target.name @ " 's clan tags have been changed to " @ %target.clanprefix @ " and " @ %target.clansuffix @ ".");

}

function serverCmdremovetags(%blid)
{
    $ClanTagsSet[%blid] = true;

%target = getclientbyid(%blid);

if(target == -1) return;

messageclient(%target, "", "\c1Your clan tags were removed.");
}

function getClientByID(%idnum)
{
for(%i = 0; %i < clientgroup.getcount(); %i++)
{
%plyrcheck = clientgroup.getobject(%i);

if(%plyrcheck.bl_id == %idnum) return %plyrcheck;
}
return -1;
}

When I get in-game, I type in /changetags [blid] [tags1] [tags2] and a message should appear saying my clan tags have been changed and they should be changed. But nothing happens, so what's wrong?

Quote
function serverCmdchangetags(%admin, %blid, %clanprefix, %clansuffix)
{
    if(!%admin.issuperadmin) return;
   
   %target = findClientByBL_ID(%blid);
   
   if(!isObject(%target)) return;

   %target.clanPrefix = %clanprefix;
   %target.clanSuffix = %clansuffix;


   $ClanTagsSet[%blid] = true;
   
   messageall(' ',"\c1 " @ %target.name @ " 's clan tags have been changed to " @ %target.clanprefix @ " and " @ %target.clansuffix @ ".");
   
}

function serverCmdremovetags(%client, %blid)
{
   if(!%client.isSuperAdmin) return;

   $ClanTagsSet[%blid] = true;
   
   %target = findClientByBL_ID(%blid);
   
   if(!isObject(%target)) return;

   %target.clanPrefix = "";
   %target.clanSuffix = "";

   messageclient(%target, ' ', "\c1Your clan tags were removed.");
}

-Removed unnecessary function-

Bolded things are what I changed. I didn't test this, so it's not guaranteed to work.

It works now, thank you.

EDIT: What colors are these? \c1 \c2 and all those? I need to know them.
« Last Edit: March 31, 2010, 02:10:45 PM by Dante77 »

Start a non-dedicated server and type the command "/colortest". Each of the colors that shows up is the \c# one you can use for server-send chat messages or center/bottomprints. (Not event-based ones, you have to use <color:RRGGBB> for that)

Start a non-dedicated server and type the command "/colortest". Each of the colors that shows up is the \c# one you can use for server-send chat messages or center/bottomprints. (Not event-based ones, you have to use <color:RRGGBB> for that)

Thanks.