Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 12-27-2011, 01:22 AM
BboyEatsbacon BboyEatsbacon is offline
The Bacon Man
BboyEatsbacon's Avatar
Join Date: Feb 2011
Location: United States
Posts: 60
BboyEatsbacon will become famous soon enough
Mute Script

Hello Everyone! I'm back to post another horrible script and hope for future improvement; today I'm "showing off" a mute script I made awhile back. It's a system based upon client. flags because players are normally only muted for short periods of time.

Weapon -Staff/Mute:
PHP Code:
function onActionServerSide() {
    if (
params[0] == "StaffMutePlayerAccount") {
        
findplayer(params[1]).addweapon("-Muted");
        
findplayer(params[1]).triggerclient("gui"name"SetMutedTimeStaff"params[2]);
        
player.chat "Muted: " params[1];
    }
    if (
params[0] == "StaffMutePlayerCommunity") {
        
findplayerbycommunityname(params[1]).addweapon("-Muted");
        
findplayerbycommunityname(params[1]).triggerclient("gui"name"SetMutedTimeStaff"params[2]);
        
player.chat "Muted: " params[1];
    }
    if (
params[0] == "StaffUnMutePlayerAccount") {
        
findplayer(params[1]).removeweapon("-Muted");
        
findplayer(params[1]).chat "Un-Muted!";
        
player.chat "Un-Muted: " params[1];
    }
    if (
params[0] == "StaffUnMutePlayerCommunity") {
        
findplayerbycommunityname(params[1]).removeweapon("-Muted");
        
findplayerbycommunityname(params[1]).chat "Un-Muted!";
        
player.chat "Un-Muted: " params[1];
    }
}

//#CLIENTSIDE
function onActionClientSide() {
   if (
params[0] == "SetMutedTimeStaff") {
       
player.client.mutedtimeleft params[1];
   }
}

function 
onPlayerChats() {
    if (
clientr.gagright == "1") {
        if (
player.chat.starts("/mute")) {
            if (
player.chat.substring(6).starts("Graal")) {
                
tokens player.chat.tokenize();
                
triggerserver("gui"name"StaffMutePlayerAccount"tokens[1], tokens[2]);
            }
            else {
                
tokens player.chat.tokenize();
                
triggerserver("gui"name"StaffMutePlayerCommunity"tokens[1], tokens[2]);
            }
        }
        if (
player.chat.starts("/unmute")) {
            if (
player.chat.substring(8).starts("Graal")) {
                
tokens player.chat.tokenize();
                
triggerserver("gui"name"StaffUnMutePlayerAccount"tokens[1], tokens[2]);
            }
            else {
                
tokens player.chat.tokenize();
                
triggerserver("gui"name"StaffUnMutePlayerCommunity"tokens[1], tokens[2]);
            }
        }
    }

Weapon -Muted:
PHP Code:
function onActionServerSide() {
    if (
params[0] == "RemoveStaffMute") {
        
player.chat "Un-Muted!";
        
removeweapon(name);
    }
}

//#CLIENTSIDE
function onCreated() {
    
setTimer(1);
    
player.chat "-Muted-";
}

function 
onPlayerChats() {
    
player.chat "-Muted-";
}

function 
onTimeOut() {
    
player.client.mutedtimeleft --;
    if (
player.client.mutedtimeleft <= 0) {
        
triggerserver("gui"name"RemoveStaffMute");
    }
    else {
        
setTimer(1);
    }

I hope I've improved at least a tad bit since my last post; I haven't had much time to focus on scripting due to other server work and school.
__________________

Last edited by BboyEatsbacon; 12-27-2011 at 06:04 AM..
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:58 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.