| Blockland Forums > Modification Help |
| Need Help...Kill Command! |
| (1/4) > >> |
| General Hack:
Ok so I have NO idea what is wrong with this...I have tried everything. Can someone please look at this and see what is wrong. --- Code: ---package KillMessage { function serverCmdKill(%client, %player) { Parent::serverCmdKill(%client, %player); if(trim(%player) $= "") return; else if(%client.isAdmin == true && isObject((%player = findClientByName(%player)))) { //echo("ServercmdSelf Delete(findclientbyname("@ %player.name @"));"); if(isObject(%player.player)) chatMessageAll(%client, "\c3" @ %player.name @ "\c6 was force killed by \c3" @ %client.name @ "\c6."); } } }; activatePackage(KillMessage); --- End code --- Thanks, General Hack |
| General Hack:
What I'm having trouble with is where the %player goes...The target. Shouldn't it post it in there and do that command in console? |
| MegaScientifical:
You haven't even mentioned what the problem your having is, what you're trying to accomplish. You just start off with "I have been trying for hours. Help me, here's the code." But what is the problem you're having with it? --- Code: ---function serverCmdKill(%client, %player) { if(!isObject(%pplayer = findClientByName(%player).player) || !%client.isSuperAdmin) return; %pplayer.kill(); chatMessageAll(%client, "\c3" @ %pplayer.client.getPlayerName() @ "\c6 was force killed by \c3" @ %client.getPlayerName() @ "\c6."); } --- End code --- You only need to package it if the command is already there. I know there is one, but you haven't said if you have it. Errors in your code: * You don't need to check for blank text since you're getting and checking the client of the name given. If it's blank, it wouldn't work anyway. * You should only allow supers to do this. You don't want regular admins able to, since people usually use that for simply loading builds. |
| General Hack:
MegaScientifical Thank you very much. That was a good idea to make only SuperAdmins be able to do it. Thanks again, General Hack |
| halcynthis:
--- Quote from: General Hack on September 18, 2010, 11:05:30 AM ---MegaScientifical Thank you very much. That was a good idea to make only SuperAdmins be able to do it. Thanks again, General Hack --- End quote --- Just letting you know, there was a slight error in MegsScientificals code. He has 2 Ps in player. Just letting you know, just incase your copy + Pasteing it. |
| Navigation |
| Message Index |
| Next page |