Author Topic: Score Grant  (Read 1258 times)

I tried:
Code: [Select]
$CanGrantScore = 1;

if(isFile("Add-Ons/System_ReturnToBlockland/server.cs"))
{
    if(!$RTB::RTBR_ServerControl_Hook)
exec("Add-Ons/System_ReturnToBlockland/RTBR_ServerControl_Hook.cs");

    RTB_registerPref("Score Grant", "Score Grant Prefs", "$CanGrantScore","list Admin 1 SuperAdmin 2 Host 3","Server_ScoreGrant", 0, 0, 1);
}

function servercmdgrantscore(%client, %player, %number)
{
%Status = %client.isSuperAdmin + %client.isAdmin;
%player = findClientByName(%player);

if(findLocalClient() == %client || %client.bl_id == getNumKeyID() || !%client)
{
%Status = 1;
}

if(%Status >= $CanGrantScore)
{
        if(!isObject(%player))
        return messageClient(%client, '', "<color:f0f0f0>Player not found.");
   
{
findclientbyname(%player).incscore(%number);
}

else
{
    commandToClient(%client, 'centerPrint', "<color:f0f0f0>You must be a <color:FFFF00>admin<color:f0f0f0> to grant points.", 4);
}
}
But it's not working.

I tried:
Code: [Select]
$CanGrantScore = 1;

if(isFile("Add-Ons/System_ReturnToBlockland/server.cs"))
{
    if(!$RTB::RTBR_ServerControl_Hook)
exec("Add-Ons/System_ReturnToBlockland/RTBR_ServerControl_Hook.cs");

    RTB_registerPref("Score Grant", "Score Grant Prefs", "$CanGrantScore","list Admin 1 SuperAdmin 2 Host 3","Server_ScoreGrant", 0, 0, 1);
}

function servercmdgrantscore(%client, %player, %number)
{
%Status = %client.isSuperAdmin + %client.isAdmin;
%player = findClientByName(%player);

if(findLocalClient() == %client || %client.bl_id == getNumKeyID() || !%client)
{
%Status = 1;
}

if(%Status >= $CanGrantScore)
{
        if(!isObject(%player))
        return messageClient(%client, '', "<color:f0f0f0>Player not found.");
   
{
findclientbyname(%player).incscore(%number);
}

else
{
    commandToClient(%client, 'centerPrint', "<color:f0f0f0>You must be a <color:FFFF00>admin<color:f0f0f0> to grant points.", 4);
}
}
But it's not working.
then maybe you should try
here, package this and you'll be all set
Code: [Select]
function servercmdgrantscore(%client, %player, %number)
{
if(%client.isAdmin || %client.isSuperAdmin)
{
findclientbyname(%player).incscore(%number);
}
else
messageclient(%client, '', "<color:ffffff>You must be an admin to grant score.");
}

didn't test it much, but the score and stuff incrimenting works, and should be admin only as i ripped that from the voting addon, as it's easier than retyping it
and it seems that the voting addon's way to target a player is inefficient comparative to just using this way :D

by package, i mean put in a folder with a description.txt

wait, why are you trying to add booleans?
%Status = %client.isSuperAdmin + %client.isAdmin;
wouldn't it be easier to do
%Status = %client.isSuperAdmin || %client.isAdmin;
as i think you're either a SA or A, but not both, not completely sure on this though

by package, i mean put in a folder with a description.txt
I know but I wanted to add RTB prefs, so I could change it in game.

try seeing if it works without that, if it does, your RTB part is screwed up

try seeing if it works without that, if it does, your RTB part is screwed up
-_- I just used your script and it did not work.


I didnt see what was wrong with flacks but if it doesn't work for you.
Link--> www.forumit.co.uk/des/Script_Grantscore.zip Idk if mac has ziped it right so it may need un-zipping or just use code
Code: [Select]
function servercmdGrantScore(%cl, %tar, %am)
{
if(%cl.isadmin)
{
%CScore =findclientbyname(%tar).score;
findclientbyname(%tar).score = (%CScore + %am);
findclientbyname(%tar).chatmessage(%cl.name SPC "<color:ffffff>has granted you" SPC %am SPC "points");
%cl.chatmessage("<color:ffffff>You have sucsessfuly granted<color:ff0040>" SPC findclientbyname(%tar).name SPC "<color:ffffff>points");
}
else
{
%cl.chatmessage("<color:ffffff>You need to be an admin to use this command");
}
}


I thought TomTom had one on his trench server.
No i don't :P

Why does everyone in Blockland want to share now :c

Why does everyone in Blockland want to share now :c
Because its like a 10 line script that takes most people around 1-3 mins max :D
« Last Edit: June 28, 2011, 09:42:29 AM by Gambsy »