SA-MP Forums Archive
Multiple help thread - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Multiple help thread (/showthread.php?tid=374423)



Multiple help thread - _Khaled_ - 02.09.2012

So, after I got my server online with OTHER players, I found out these errors.
First, DONE

Second, /mute, if I for example mute ID 1 or "Ejb" it shows An Administrator has muted EJB, but I'm the one muted.
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(IsMuted[playerid] == 1)
    {
        SendClientMessage(playerid, 0xFF0000FF, "You are currently muted, you can't use the chat.");
        return 0;
    }
    return 1;
}
//============================================================================//
dcmd_mute(playerid,params[])
{
    #pragma unused params
    new pname[MAX_PLAYER_NAME];
    new string[128];
    new cmdreason[100];
    new id;
    if(sscanf(params,"us[100]",id,cmdreason))
    {
        SendClientMessage(playerid,COLOR_ERROR,"Usage: /mute (Player Name/ID) (Reason)");
        return 1;
    }
    GetPlayerName(id,pname,sizeof pname);
    if(IsMuted[playerid] == 1)
    {
        format(string,sizeof(string),"%s(%d) is already muted by an Administrator.",pname,id);
        SendClientMessage(playerid,COLOR_RED,string);
        return 1;
    }
    IsMuted[playerid] =1;
    format(string,sizeof(string),"***An Administrator has muted %s(%d).  (Reason: %s.)",pname,id,cmdreason);
    SendClientMessageToAll(COLOR_PINK,string);

    //format(string,sizeof(string),"9[ADMIN] Administrator has frozen %s(%d) for reason: %s.",PlayerName(ID),ID,cmdreason);
    //IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
    return 1;
}
//============================================================================//
dcmd_unmute(playerid,params[])
{
    #pragma unused params
    new pname[MAX_PLAYER_NAME];
    new string[128];
    new id;
    if(sscanf(params,"us[100]",id))
    {
        SendClientMessage(playerid,COLOR_ERROR,"Usage: /unmute (Player Name/ID)");
        return 1;
    }
    GetPlayerName(id,pname,sizeof pname);
    if(IsMuted[playerid] == 0)
    {
        format(string,sizeof(string),"%s(%d) is already un-muted by an Administrator.",pname,id);
        SendClientMessage(playerid,COLOR_RED,string);
        return 1;
    }
    IsMuted[playerid] =0;
    format(string,sizeof(string),"***An Administrator has un-muted %s(%d)",pname,id);
    SendClientMessageToAll(COLOR_PINK,string);

    //format(string,sizeof(string),"9[ADMIN] Administrator has un-muted %s(%d) for reason: %s.",PlayerName(ID),ID,cmdreason);
    //IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
    return 1;
}
Third, /whisper shows all over the map! <3
pawn Код:
//Stock GetDistanceBetweenPlayers
stock Float:GetDistanceBetweenPlayers(playerid, targetplayerid)
{
    new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
    if(!IsPlayerConnected(playerid) || !IsPlayerConnected(targetplayerid)) {
    return -1.00;
    }
    GetPlayerPos(playerid,x1,y1,z1);
    GetPlayerPos(targetplayerid,x2,y2,z2);
    return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
//============================================================================//
dcmd_w(playerid,params[])
{
    #pragma unused params
    new string[128];
    new id;
    new pname[MAX_PLAYER_NAME];
    if(!strlen(params))
    {
        SendClientMessage(playerid,COLOR_ERROR,"Usage: /w(hisper) (Message)");
        return 1;
    }
    /*format(string, sizeof(string), "[WHISPER] %s(%d): %s",pname,playerid,params);
    printf("%s", string);
    IRC_GroupSay(gGroupAdminID,IRC_ADMINCHANNEL,string);*/

    for(new i=0;i<MAX_PLAYERS;++i)
    {
        if(GetDistanceBetweenPlayers(playerid,i) < 10)
        {
            GetPlayerName(id,pname,MAX_PLAYER_NAME);
            format(string, sizeof(string), "[WHISPER]: %s(%d): %s",pname,playerid,params);
            SendClientMessage(i,COLOR_YELLOW,string);
        }
    }
    return 1;
}

dcmd_whisper(playerid,params[]) return dcmd_w(playerid,params);
Fourth, same as mute! but for KICK!
pawn Код:
dcmd_kick(playerid,params[])
{
    #pragma unused params
    new pname[MAX_PLAYER_NAME];
    new string[128];
    new id;
    new cmdreason[100];
    if(sscanf(params,"us[100]",id,cmdreason))
    {
        SendClientMessage(playerid,COLOR_ERROR,"Usage: /kick (Player Name/ID) (Reason)");
        return 1;
    }
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string,sizeof(string),"***An Administrator has kicked %s(%d) from the server.  (Reason: %s.)",pname,id,cmdreason);
    SendClientMessageToAll(COLOR_PINK,string);
    Kick(playerid);

    /*format(string,sizeof(string),"9[ADMIN] Administrator has kicked %s(%d) from the server. Reason: %s.",PlayerName(ID),ID,cmdreason);
    IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
    SetTimer("KickPlayer",700,0);*/

    return 1;
}
Fifth, the auto messages are not LONG enough, example
pawn Код:
if (!response)
            {
               GetPlayerName(playerid, pname, sizeof(pname));
               format(string, sizeof(string), "***(Auto-Kick) %s(%d) Has been kicked from the server. (Reason: Failure to register)", pname, id, aDisconnectNames);
               SendClientMessageToAll(COLOR_PINK, string);
               Kick(playerid);
               return 1;
            }
It cuts at Fail... if the name of player is long..

That's all!
Any help? :\


Re: Multiple help thread - Misiur - 02.09.2012

You need to change playerid to id in kick (Kick function) and mute (IsMuted variable) commands. OnPlayerConnect change ID to playerid and remove unused variable.

I'm too tired to help further


Re: Multiple help thread - _Khaled_ - 02.09.2012

Could you please post pawn codes of mute


Re: Multiple help thread - sampreader - 02.09.2012

ill do the first 1

Код:
//Public OnPlayerConnect.
public OnPlayerConnect(playerid)
{
         new pname[MAX_PLAYER_NAME], string[63 + MAX_PLAYER_NAME];
         new ID; <<<<<<<<<<< This variable is not needed
        // Server Related shit.
        GetPlayerName(playerid, pname, sizeof(pname));
        format(string, sizeof(string), "%s(%d) has joined the server.", pname, ID); // The variable ID should be playerid
        SendClientMessageToAll(COLOR_CYAN, string);
        return 1;
}



Re: Multiple help thread - _Khaled_ - 02.09.2012

Nevermind First question.


Re: Multiple help thread - _Khaled_ - 02.09.2012

Someone got help with the Q3 and Q5?


Re: Multiple help thread - _Khaled_ - 02.09.2012

Bump


Re: Multiple help thread - Akira297 - 02.09.2012

which ones are remaining?


Re: Multiple help thread - _Khaled_ - 02.09.2012

Q3 and Q5


Re: Multiple help thread - _Khaled_ - 02.09.2012

Bump