Quantcast
Channel: SA-MP Forums - Filterscripts
Viewing all articles
Browse latest Browse all 595

[FilterScript] Helper's System && Other Scripts

$
0
0
Introduction:hello guys, i scripted this first filterscript of helpers system because i checked their are very less scripts of helpers so i created i hope you like it

Helper's System

Helper's Commands:
/reply,
/hc,
/hduty,
hsay,
/pm,
/hgoto,
/hget


Installation:

1> Copy the code and compile it.
2> Put the amx in filterscripts folder.
3> Add name of filterscript in server.cfg.
4> Created folder named "helpers" in scriptfiles

Code:
PHP Code:

/* 2 Level's Helper System By PremiumGamer */
#define FILTERSCRIPT

#include <a_samp>
#include <dini>
#include <zcmd>
#include <foreach>
#include <sscanf2>

/* Colors */
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_YELLOW 0xFFFF00FF
#define COLOR_RED 0xFF0000FF
#define COLOR_HELPER 0x00E5EEFF

/* new defines */
new helper[MAX_PLAYERS];
new 
conversation[MAX_PLAYERS];

/*Saving*/
#define FILE_HELPER "helpers/%s.ini"

/* Players */
stock Players(playerid)
{
    new 
name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnamesizeof(name));
    return 
name;
}

public 
OnFilterScriptInit()
{
    print(
"\n--------------------------------------");
    print(
" 2 Level's Helper System By PremiumGamer");
    print(
"--------------------------------------\n");
    return 
1;
}

public 
OnFilterScriptExit()
{
    return 
1;
}

public 
OnPlayerRequestClass(playeridclassid)
{
    
SetPlayerPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraLookAt(playerid1958.37831343.157215.3746);
    return 
1;
}

public 
OnPlayerConnect(playerid)
{
    return 
1;
}

public 
OnPlayerDisconnect(playeridreason)
{
    return 
1;
}

CMD:sethelper(playeridparams[])
{
    new 
giveplayeridmoneys1giveplayer[25], string[256], playername[25], helpers[MAX_PLAYERS];
    if (
sscanf(params"ud"giveplayeridmoneys1)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /sethelper [playerid] [0 = not helper, 1 = helper, 2 = helper level 2]");
    if (!
IsPlayerConnected(giveplayerid)) return SendClientMessage(playeridCOLOR_RED"Error: Inactive player id!");
    if (
moneys1 || moneys1 2) return SendClientMessage(playeridCOLOR_RED"Error: 0 = not helper, 1 = helper level 1, 2 = helper level 2.");
    
GetPlayerName(giveplayeridgiveplayerMAX_PLAYER_NAME);
    if (
moneys1 == helper[giveplayerid])
    {
        if (
giveplayerid != playerid)
        {
            if (
moneys1 == 0)
            {
                
format(string64"%s is not set as a helper."giveplayer);
                
SendClientMessage(playeridCOLOR_WHITEstring);
            }
            else
            {
                
format(string64"%s is already set as a helper."giveplayer);
                
SendClientMessage(playeridCOLOR_WHITEstring);
            }
        }
        else
        {
            if (
moneys1 == 0SendClientMessage(playeridCOLOR_WHITE"You are not set as a helper.");
            else 
SendClientMessage(playeridCOLOR_WHITE"You are already set as a helper.");
        }
        return 
1;
    }
    
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
    if (
moneys1 != 0)
    {
        
format(helperssizeof(helpers), FILE_HELPERgiveplayer);
        
dini_IntSet(helpers"helper"moneys1);
        if (
giveplayerid != playerid)
        {
            
SendClientMessage(giveplayeridCOLOR_YELLOW"You have been set as a helper.");
            
format(string64"You have set %s as a helper."giveplayer);
            
SendClientMessage(playeridCOLOR_YELLOWstring);
            
SendClientMessage(giveplayeridCOLOR_YELLOW"Check /hcmds for available helper commands.");
        }
        else 
SendClientMessage(playeridCOLOR_YELLOW"You have set yourself as a helper.");
    }
    else
    {
        
format(helperssizeof(helpers), FILE_HELPERgiveplayer);
        
dini_IntSet(helpers"helper"moneys1);
        if (
giveplayerid != playerid)
        {
            
SendClientMessage(giveplayeridCOLOR_WHITE"You have been removed as a helper.");
            
format(string64"You have removed %s as a helper."giveplayer);
            
SendClientMessage(playeridCOLOR_YELLOWstring);
        }
        else 
SendClientMessage(playeridCOLOR_WHITE"You have removed yourself as a helper.");
    }
    
helper[giveplayerid] = moneys1;
    return 
1;
}

// Helpers Commands
CMD:hcmds(playeridparams[])
{
    if(!
helper[playerid]) return 0;
    if(
helper[playerid] == 1)
    {
        
SendClientMessage(playeridCOLOR_HELPER"Junior Helper Commands");
        
SendClientMessage(playeridCOLOR_WHITE"/reply, /hc, /hduty, /hsay, /pm");
    }
    if(
helper[playerid] == 2)
    {
        
SendClientMessage(playeridCOLOR_HELPER"Senior Helper Commands");
        
SendClientMessage(playeridCOLOR_WHITE"/reply, /hc,/hduty, hsay, /pm, /hgoto, /hget");
    }
    return 
1;
}

//if any player do /ask then the heleprs cn help him by /reply
CMD:reply(playeridparams[])
{
    new 
giveplayeridtmp2[256], moneys1playername[25], giveplayer[25], string[270];
    if (
helper[playerid] == 0) return SendClientMessage(playeridCOLOR_RED"Error: You aren't a helper.");
    if (
sscanf(params"us[128]"giveplayeridtmp2)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /reply [playerid] [message]");
    if (!
IsPlayerConnected(giveplayerid)) return SendClientMessage(playeridCOLOR_RED"Error: Inactive player id!");
    if(
conversation[giveplayerid] == 0) return SendClientMessage(playeridCOLOR_RED"Error: That player did not start coversation with helpers team!");
    
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
    
GetPlayerName(giveplayeridgiveplayerMAX_PLAYER_NAME);
    if (
helper[playerid] == 1)
    
format(string64"Help - %s: %s"playernametmp2);
    
SendClientMessageToAll(giveplayerid,string);
    for (new 
0MAX_PLAYERSi++)
    {
        if (
IsPlayerConnected(i) && helper[i] == && != giveplayerid)
        {
            
format(string64"[Junior Helper] - %s: %s"playernametmp2);
            
SendClientMessageToAll(i,string);
            
moneys1 ++;
        }
    }
    if (
helper[playerid] == 2)
    
format(string64"Senior Helper - %s: %s"playernametmp2);
    
SendClientMessageToAll(playerid,string);
    for (new 
0MAX_PLAYERSi++)
    {
        if (
IsPlayerConnected(i) && helper[i] == && != giveplayerid)
        {
            
format(string64"[Senior Helper] - %s: %s"playernametmp2);
            
SendClientMessageToAll(i,string);
            
moneys1 ++;
        }
    }
    
printf("[helper] %s (Id%d) to %s (Id%d) %s"playernameplayeridgiveplayergiveplayeridtmp2);
    return 
1;
}
//you can /hsay to show players tht if u need help do /ask
CMD:hsay(playeridparams[])
{
    new 
tmp[256], playername[25], tmp2[256],string[256];
    if (
helper[playerid] == 0) return SendClientMessage(playeridCOLOR_RED"Error: You aren't a helper.");
    if (
sscanf(params"s[128]"tmp)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /hsay [message]");
    
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
    if (
helper[playerid] == 1)
    {
    
format(tmp2sizeof(tmp2), "say %s"tmp);
    
format(stringsizeof(string), "* Junior Helper: %s"tmp);
    
SendClientMessageToAll(COLOR_HELPERstring);
    }
    if (
helper[playerid] == 2)
    {
       
format(tmp2sizeof(tmp2), "say %s"tmp);
    
format(stringsizeof(string), "* Senior Helper: %s"tmp);
    
SendClientMessageToAll(COLOR_HELPERstring);
    }
    
printf("[ssay] %s: %s"playernametmp);
    return 
1;
}
//this is helpers chat here helpers can do chatting
CMD:hc(playeridparams[])
{
    new 
tmp[256], tmp2[256], playername[25];
    if (
helper[playerid] == 0) return SendClientMessage(playeridCOLOR_RED"Error: You aren't a helper.");
    if (
sscanf(params"s[128]"tmp)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /hc [message]");
    if (
helper[playerid] == 1)
    
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
    
format(tmp2sizeof(tmp2), "Junior Helper [%s] %s"playernametmp);
    for (new 
0MAX_PLAYERSi++)
    {
        if (
IsPlayerConnected(i) && helper[i] == 1SendClientMessage(iCOLOR_HELPERtmp2);
    }
    if (
helper[playerid] == 2)
    
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
    
format(tmp2sizeof(tmp2), "Senior Helper [%s] %s"playernametmp);
    for (new 
0MAX_PLAYERSi++)
    {
        if (
IsPlayerConnected(i) && helper[i] == 2SendClientMessage(iCOLOR_HELPERtmp2);
    }
    
printf(tmp2);
    return 
1;
}
//by doing /hduty player will go on helpers duty and then if other players need help they cn do /ask
CMD:hduty(playeridparams[])
{
    new 
playername[MAX_PLAYER_NAME], string[270];
    if (
helper[playerid] == 0) return SendClientMessage(playeridCOLOR_RED"Error: You aren't a helper.");
    
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
    if(
GetPVarInt(playerid"helperduty") == 0)
    {
        
SetPVarInt(playerid"playercolor"GetPlayerColor(playerid));
        
SetPlayerColor(playeridCOLOR_HELPER);
        
SetPVarInt(playerid"helperduty"1);
        
format(string64"%s is now helper on duty, use /ask if you need any help!"playername"");
        
SendClientMessageToAll(COLOR_HELPER,string);
    }
    else
    {
        
SetPlayerColor(playeridGetPVarInt(playerid"playercolor"));
        
SetPVarInt(playerid"helperduty"0);
        
format(string64"%s is now helper off duty."playername);
        
SendClientMessageToAll(COLOR_HELPER,string);
    }
    return 
1;
}
//this cmd allows you to pm other players
CMD:pm(playeridparams[])
{
    new 
tmp[160], giveplayeridgiveplayer[25], playername[25],string[256];
    if(
helper[playerid] == 0) return 0;
    
GetPlayerName(giveplayeridgiveplayerMAX_PLAYER_NAME);
    if (
sscanf(params"us[160]"giveplayeridtmp)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /pm [playerid] [message]");
    if (!
IsPlayerConnected(giveplayerid)) return SendClientMessage(playeridCOLOR_RED"Error: Inactive player id!");
    if (
giveplayerid == playerid) return SendClientMessage(playeridCOLOR_RED"Error: You can't send private message to your self!");
    
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
    
GetPlayerName(giveplayeridgiveplayerMAX_PLAYER_NAME);
    
format(stringsizeof(string), "{E6E600}PM from %s(%d): %s"playernameplayeridtmp);
    
SendClientMessage(giveplayeridCOLOR_YELLOWstring);
    
format(string,sizeof(string), "{FFFF00}PM to %s(%d): %s"giveplayergiveplayeridtmp);
    
SendClientMessage(giveplayeridCOLOR_YELLOW"You can use /pmr [message] for fast reply.");
    
SendClientMessage(playeridCOLOR_WHITEstring);
    return 
1;
}
//by this players can ask question about ur server or if they need help
CMD:ask(playeridparams[])
{
        new 
tmp[254],string[200],playername[64],moneys1;
        if (
sscanf(params"s[128]"tmp)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /ask [message]");
        
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
        for (new 
0MAX_PLAYERSi++)
        {
            if (!
IsPlayerConnected(i) || helper[i] == 0) continue;
            {
                
format(stringsizeof(string), "%s (Id%d) asked: %s"playernameplayeridtmp);
                
SendClientMessage(iCOLOR_HELPERstring);
            }
            
moneys1 ++;
        }
        if (
moneys1 != 0)
        {
            
format(string64"You asked: %s"tmp"");
            
SendClientMessage(playeridCOLOR_HELPER,string);
            
printf("[ask] %s (Id%d) %s"playernameplayeridtmp);
            
conversation[playerid] = 1;
        }
        else
        {
            
SendClientMessage(playeridCOLOR_RED"There are currently no helpers online.");
        }
        return 
1;
}
//by this cmd you can end the ask
CMD:askend(playerid,params[])
{
    if(
conversation[playerid] == 0) return SendClientMessage(playerid,COLOR_RED,"Error: You are not talking to a helper.");
    
conversation[playerid] = 0;
    
SendClientMessage(playerid,COLOR_RED,"You have ended your conversation with the helpers team.");
    return 
1;
}

//by this command players can see how much helpers online and who is online
CMD:hdos(playeridparams[])
{
    new 
moneys1string[128], string1[270];
     for (new 
0MAX_PLAYERSi++)
     {
          if (
IsPlayerConnected(i))
          {
           if (
helper[i] == 1)
           {
                
moneys1 ++;
           }
           else if(
helper[i] == 2)
           {
                 
moneys1++;
           }
          }
     }
     if (
moneys1 != 0)
     {
        
SendClientMessage(playeridCOLOR_HELPER"Current Online Help Desk Operators:");
          for (new 
0MAX_PLAYERSi++)
        {
             if (
IsPlayerConnected(i))
              {
                   if (
helper[i] == 1)
                {
                      
format(string128"Junior Helper: %s(%d) {FFFFFF}[Level 1]"Players(i), i);
                      
SendClientMessage(playeridCOLOR_HELPERstring);
                }
                      else if (
helper[i] == 2)
                {
                      
format(string1128"Senior Helper: %s(%d) {FFFFFF}[Level 2]"Players(i), i);
                      
SendClientMessage(playeridCOLOR_HELPERstring1);
                }
            }
             }
     }
     else 
SendClientMessage(playeridCOLOR_RED"There are currently no help desk operators online.");
     return 
1;


Credits:
SA-MP Team for a_samp.inc
Y_Less and Emmet_ for sscanf2.inc
DracoBlue for Dini.inc
ZeeX for Zcmd.inc

Viewing all articles
Browse latest Browse all 595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>