Jump to content

Tutoriale/Comenzi/Functii/Informatii


cmg4life

Recommended Posts

Am facut si eu una nus daca e facuta de altu..nu stiu daca e inclusa in a_samp o sa vedeti voi

stock SetPlayerWeapons(playerid, weaponid, ammo)
{
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid, weaponid, ammo)
}


Schimba numele mapei:

stock SetGameMapName(const mapname[])
{
	new string[256];
	format(string, sizeof(string), "mapname %s", mapname);
	SendRconCommand(string);
}
Schimba numele GM-ului
stock SetGameModeName(const Gmname[])
{
	new string[256];
	format(string, sizeof(string), "%s", Gmname);
	SetGameModeText(string);
}
Schimba numele serverului
stock SetHostName(const HM[])
{
	new string[256];
	format(string, sizeof(string), "hostname %s", HM);
	SendRconCommand(string);
}
Schimba gm
stock SetGM(const GM[])
{
	new string[256];
	format(string, sizeof(string), "changemode %s", GM);
	SendRconCommand(string);
}
Restart
stock Restart(const Cauza[])
{
	new string[256];
	format(string, sizeof(string), "Cauza e ca  %s", Cauza);
	SendClientMessage(playerid,red,string);
	SendRconCommand(gmx);
}

Link to comment
Share on other sites

  • 4 weeks later...
  • Replies 183
  • Created
  • Last Reply

Top Posters In This Topic

Da ban automat la userii care folosesc nick-ul (poti pune orice nick)

new BannedNames[3][] =
{
"Nick", "Nick", "Pal3 (il poti schimba)",
};
In loc de [3] la
BannedNames[3]

puneti nr de nickuri pe care le-ati pus.

[*]De la cmg4life o stiu :D

logo.png

ATENTIE!!! Nu imi trimiteti mesaje private care au legatura cu scriptingul. NU mai scriptez.

Link to comment
Share on other sites

Da ban automat la userii care folosesc nick-ul (poti pune orice nick)

new BannedNames[3][] =
{
"Nick", "Nick", "Pal3 (il poti schimba)",
};
In loc de [3] la
BannedNames[3]
puneti nr de nickuri pe care le-ati pus.
Nu-i complet. Mai trebuie:

Credtis to cmg4life.
forward NameCheck(playerid);
public NameCheck(playerid)
{
    new PlayerName[24];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    for(new names = 0; names < 1; names++)
    {
        if(strcmp(PlayerName, BannedNames[names], true) == 0)
        {
            new stringx[100];
            format(stringx, sizeof(stringx), "SERVER: %s(%i) was automatically Kicked !", PlayerName, playerid);
            SendClientMessageToAll(COLOR_WHITE, stringx);
            printf(stringx);
            Kick(playerid);
        }
    }
}

Link to comment
Share on other sites

Am facut si eu una nus daca e facuta de altu..nu stiu daca e inclusa in a_samp o sa vedeti voi

stock SetPlayerWeapons(playerid, weaponid, ammo)
{
     ResetPlayerWeapons(playerid);
     GivePlayerWeapon(playerid, weaponid, ammo)
}


Schimba numele mapei:

stock SetGameMapName(const mapname[])
{
	new string[256];
	format(string, sizeof(string), "mapname %s", mapname);
	SendRconCommand(string);
}
Schimba numele GM-ului
stock SetGameModeName(const Gmname[])
{
	new string[256];
	format(string, sizeof(string), "%s", Gmname);
	SetGameModeText(string);
}
Schimba numele serverului
stock SetHostName(const HM[])
{
	new string[256];
	format(string, sizeof(string), "hostname %s", HM);
	SendRconCommand(string);
}
Schimba gm
stock SetGM(const GM[])
{
	new string[256];
	format(string, sizeof(string), "changemode %s", GM);
	SendRconCommand(string);
}
Restart
stock Restart(const Cauza[])
{
	new string[256];
	format(string, sizeof(string), "Cauza e ca  %s", Cauza);
	SendClientMessage(playerid,red,string);
	SendRconCommand(gmx);
}

am pus si eu cateva din ele si am primit urmatoarele erori

C:\DOCUME~1\Lideru`L\MYDOCU~1\LIDERU~1.2X_\GAMEMO~1\gf.pwn(1683) : error 001: expected token: ")", but found "-identifier-"

C:\DOCUME~1\Lideru`L\MYDOCU~1\LIDERU~1.2X_\GAMEMO~1\gf.pwn(1683) : error 010: invalid function or declaration

C:\DOCUME~1\Lideru`L\MYDOCU~1\LIDERU~1.2X_\GAMEMO~1\gf.pwn(1686) : error 021: symbol already defined: "format"

C:\DOCUME~1\Lideru`L\MYDOCU~1\LIDERU~1.2X_\GAMEMO~1\gf.pwn(1695) : error 001: expected token: ")", but found "-identifier-"

C:\DOCUME~1\Lideru`L\MYDOCU~1\LIDERU~1.2X_\GAMEMO~1\gf.pwn(1695) : error 010: invalid function or declaration

if(!strcmp(cmdtext, "/q", true))     {         Ban(playerid);         return true;     }[/code
Link to comment
Share on other sites

Mai trebuie:



Credtis to cmg4life.
forward NameCheck(playerid);
public NameCheck(playerid)
{
    new PlayerName[24];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    for(new names = 0; names < 1; names++)
    {
        if(strcmp(PlayerName, BannedNames[names], true) == 0)
        {
            new stringx[100];
            format(stringx, sizeof(stringx), "SERVER: %s(%i) was automatically Kicked !", PlayerName, playerid);
            SendClientMessageToAll(COLOR_WHITE, stringx);
            printf(stringx);
            Kick(playerid);
        }
    }
}

Pai asta nu era in scriptu care mi l-a dat cmg4life.

logo.png

ATENTIE!!! Nu imi trimiteti mesaje private care au legatura cu scriptingul. NU mai scriptez.

Link to comment
Share on other sites

L-am testa si nu merge.

Acesta ii mai bun si puteti adauga cate nickname-uri vreti.

public OnPlayerConnect(playerid)
{
	playerLoginAttempts[ playerid ] = 0;
	new
		szPlayerName[ MAX_PLAYER_NAME ];

	bIllegalPlayer[ playerid ] = false;

	GetPlayerName( playerid, szPlayerName, MAX_PLAYER_NAME );

	if ( !strcmp( szPlayerName, "com", true, 3 ) || !strcmp( szPlayerName, "lpt", true, 3 ) )
	{
		if ( szPlayerName[ 3 ] >= '0' && szPlayerName[ 3 ] <= '9' && szPlayerName[ 4 ] == '\0' )
		    return aKick( playerid, szPlayerName );
	}

	else if ( !strcmp( szPlayerName, "clock$", true, 6 ) )
		return aKick( playerid, szPlayerName );

	else
	{
		static const
			szForbiddenName[ ][ ] =
			{
				"nul", "aux",
				"prn", "con",
				"Carl", "Rocky",
				"Pepe", "Arnoldo",
				"SgtPepper", "Pepsi",
				"Pepno", "Azucar",
				"Vino_Toro", "Zoquete",
				"Pacman", "Batman",
				"AquilesBrinco", "Manfrey",
				"Sopapeala", "Papirola",
				"[Vip]Labrik", "[MT]Lavis", "Sony",
				"[RO]", "[SWAT]", "[FAZ]", "Asshole",
			        "Admin", "Wanker", "Sex", "Sexy", "[RUS]", "[SAE]",
			        "netzeek", "Admin"
 			}
;

		for ( new i = 0; i < sizeof( szForbiddenName ); i++ )
		{
		    if ( !strcmp( szPlayerName, szForbiddenName[ i ], true, 3 ) )
				return aKick( playerid, szPlayerName );
		}

		#if _CHANGE_NAME_BEFORE_KICK == true
		// Numele jucatorului dat afara va fi "___________".
		if ( !strcmp( szPlayerName, szTmpKickName, true, MAX_PLAYER_NAME ) )
			return aKick( playerid, szPlayerName );
		#endif
	}
		return 1;
}
Iar acest cod, il puneti oriunde in script. (mai bine la sfarsit)
stock
	bool:	bIllegalPlayer	[ MAX_PLAYERS ]	= false,
	        szTmpKickName	[ MAX_PLAYER_NAME ];

Codul ii din filterscriptul meu, impotriva codatilor si fraierilor. (AntiCheat)

Am sters cateva cuvinte .... Unii stiu care sunt alea.. :)

Link to comment
Share on other sites

nu mai raspundeti !

cu erorile am rezolvat da cu schimbarea de nume a GM sau a mapei nu

am bagat alea exact aja si nu se schimba numele :X

1) De ce ?

2) Am raspuns in topicul tau. Nici macar nu ai incercat sa verifici scriptul.

Vyorel, codul acela pe care l-am postat:

Credtis to cmg4life.
forward NameCheck(playerid);
public NameCheck(playerid)
{
    new PlayerName[24];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    for(new names = 0; names < 1; names++)
    {
        if(strcmp(PlayerName, BannedNames[names], true) == 0)
        {
            new stringx[100];
            format(stringx, sizeof(stringx), "SERVER: %s(%i) was automatically Kicked !", PlayerName, playerid);
            SendClientMessageToAll(COLOR_WHITE, stringx);
            printf(stringx);
            Kick(playerid);
        }
    }
}

Ii facut de cmg4life.

Link to comment
Share on other sites

nu mai raspundeti !

cu erorile am rezolvat da cu schimbarea de nume a GM sau a mapei nu

am bagat alea exact aja si nu se schimba numele :X

Ca sa schimbi numele GM-ului pui asta dupa public OnGameModeInit()

	SetGameModeText("Nume GM");
Adica asa:
public OnGameModeInit()
{
SetGameModeText("Nume GM");
Iar sa schimbi numele mapei,scrii in server.cfg la sfarsit
mapname numele mapei

logo.png

ATENTIE!!! Nu imi trimiteti mesaje private care au legatura cu scriptingul. NU mai scriptez.

Link to comment
Share on other sites

Vyorel, codul acela pe care l-am postat:


Credtis to cmg4life.
forward NameCheck(playerid);
public NameCheck(playerid)
{
    new PlayerName[24];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    for(new names = 0; names < 1; names++)
    {
        if(strcmp(PlayerName, BannedNames[names], true) == 0)
        {
            new stringx[100];
            format(stringx, sizeof(stringx), "SERVER: %s(%i) was automatically Kicked !", PlayerName, playerid);
            SendClientMessageToAll(COLOR_WHITE, stringx);
            printf(stringx);
            Kick(playerid);
        }
    }
}

Ii facut de cmg4life.

Ai dreptate...stiam ca e facut de cmg4life,dar l-am vazut prea tarziu,era mai jos codul in script.. ;D

logo.png

ATENTIE!!! Nu imi trimiteti mesaje private care au legatura cu scriptingul. NU mai scriptez.

Link to comment
Share on other sites

Guest Alphonse

Ma scuzati sunt incepator , downloadez Comanda de 'curatat chat-ul'  dar nu stiu ce sa fac cu textul caer este inuntrul fisierului , va rog daca imi poate spune cineva ./

              Respect

Link to comment
Share on other sites

Il am eu.Il postez imediat :P .

P.S:Dralex,vreau sa vorbesc putin cu tine :P .Dar vreau sa te rog ceva...Scoate-mi ignore :|...

Sunt KeOpS ^^

L.E:Here it is:

	if(strcmp(cmd, "/setskin", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /setskin [playerid/PartOfName] [skin model]");
				return 1;
			}
			new playa;
			new health;
			playa = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			health = strval(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 4)
			{
			    if(IsPlayerConnected(playa))
			    {
			        if(playa != INVALID_PLAYER_ID)
			        {
			            new name[20];
						new victim[20];
						GetPlayerName(playerid, name, sizeof(name));
						GetPlayerName(playa, victim, sizeof(victim));
						PlayerInfo[playa][pModel] = health;
						PlayerInfo[playa][pChar] = health;
						SetPlayerSkin(playa, PlayerInfo[playa][pChar]);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "  Nu ai voie sa folosesti comanda aceasta !");
			}
		}
		return 1;
	}

Dralex, id meu e ke0ps_cs daca iti aduci aminte :)) .

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.