SA-MP Forums Archive
how to add this - 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: how to add this (/showthread.php?tid=326364)



how to add this - [FoR]EveR - 17.03.2012

Say me how to add this code in my trucking server

Код:
CMD:announce(playerid, params[])
{
    new pid;
    if (APlayerData[playerid][PlayerLevel] >= 1)
    {
        if(!sscanf(params, "ui", pid))
			{
			    new string[256];
			    format(string, sizeof(string), "Announcement by %s: %s", GetName(pid), text);
			    SendClientMessage(playerid, COLOR_RED, string);
			    return 1;
			}
			else return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /announce [Text]");
    }
	else SendClientMessage(playerid, COLOR_RED, "You do not have access to this command");
	return 1;
}



Re: how to add this - GNGification - 17.03.2012

Hmm what you actually mean? it has bugs?
Or if this is so simple, just paste the code in your script and give credits for its original maker?


Re: how to add this - [FoR]EveR - 17.03.2012

but 4 warning who can create one code? with /announce /giveweapon


Re: how to add this - GNGification - 17.03.2012

What are the warnings?
And with announce you mean GameText?


Re: how to add this - Ronaldo_raul™ - 17.03.2012

Is the code copied off from any gamemode, filterscript or something ? If yes than tell us from where.

If no than i have scripted the whole command again. -

pawn Код:
CMD:announce ( playerid , params [] )
{
    if ( !IsPlayerAdmin ( playerid ) ) return SendClientMessage ( playerid , -1 , "Your not admin" ) ;
    new pName [ MAX_PLAYER_NAME ] ;
    GetPlayerName ( playerid , pName , MAX_PLAYER_NAME ) ;
    new str [128] ;
    format ( str , 128 , "Announcement by %s : %s" , pName , params ) ;
    SendClientMessage ( playerid , -1 , str ) ;
    return 1;
}
Not Tested :S


Re: how to add this - [FoR]EveR - 17.03.2012

add this to script ?


Re: how to add this - [FoR]EveR - 17.03.2012

but i dont need this i want Centered announce /ann or /announce


Re: how to add this - JJB562 - 17.03.2012

I made a script:

pawn Код:
CMD:announce(playerid, params[])
{
    new playername[MAX_PLAYER_NAME], string[128], message[128];
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLORHERE, "You Need To Be An Admin To Use This Command"); //replace COLORHERE with one of your implemented colors from your script
    if(sscanf(params, "s", message))
    {
        GetPlayerName(playerid, playername, sizeof(playername));
        format(string, sizeof(string), "Announcement by %s: %s", playername, message);
    }
    else return SendClientMessage(playerid, COLORHERE, "Usage: /announce [Message]"); //replace COLORHERE with one of your implemented colors from your script
    return 1;
}



Re: how to add this - [FoR]EveR - 17.03.2012

i want centered announce /ann or /announce not in global chat for all admins


Re: how to add this - tyler12 - 17.03.2012

pawn Код:
COMMAND:announce(playerid, params[])
{
    SendAdminText(playerid, "/announce", params);

    if (APlayerData[playerid][LoggedIn] == true)
    {
        // Check if the player's admin-level is at least 1
        if (APlayerData[playerid][PlayerLevel] >= 1)
        {
                        GameTextForAll(params,4000,3);
        }
        else
                    return 0;
    }
    else
        return 0;

    // Let the server know that this was a valid command
    return 1;
}
this is the code from my server using ppc_trucking gamemode