how to add this
#1

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;
}
Reply
#2

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?
Reply
#3

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

What are the warnings?
And with announce you mean GameText?
Reply
#5

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
Reply
#6

add this to script ?
Reply
#7

but i dont need this i want Centered announce /ann or /announce
Reply
#8

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;
}
Reply
#9

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)