Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Face9000

Pages: [1]
1
Pawn Code Snippets / Re: Detect if player is flying
« on: February 10, 2011, 09:46:16 am »
Its only Detecting The Flying Hacks ? Dosen't it detect the Airbreak ?

It detects if a player is in a flying vehicle such as a heli or a plane.

This ^

This stock doesnt detect airbreak :P

2
Pawn Full Scripts / Re: [TUTORIAL]How to make simple logs for your server.
« on: February 10, 2011, 09:45:03 am »
Dont forget - if the folder is not created before the script is started - you may get some errors.

Yes.

3
Pawn Full Scripts / How to make autoannounces
« on: February 09, 2011, 08:12:49 pm »
Have a populated server and want some messages showing in the middle of the screen at all players?

Well,with this tutorial now u can.

WARNING: THERE ARE NOT NORMAL MESSAGE PASTED IN CHAT,BUT ANNOUNCES WITH YOUR TEXT SHOWING IN THE MIDDLE OF SCREEN.

Let's start by creating a timer of 120000 milliseconds (2 minutes). You can always change it.

Paste it under OnGameModeInit:

Code: [Select]
SetTimer("AutoAnn",120000,1);
Now,let's create the forward and the public function.

Paste the code where u want.

Code: [Select]
forward AutoAnn();
public AutoAnn()
{
    new randANN = random(sizeof(RandomANN));
    GameTextForAll(RandomANN[randANN], 10000, 4);
return 1;
}

Explain:

We've created the forward and the public function.

With:

Code: [Select]
new randANN = random(sizeof(RandomANN));
Server will take a random text (Look under for more info) and shows as announce ingame.

Code: [Select]
  GameTextForAll(RandomANN[randANN], 10000, 4);
Is for show the announce.

Ok,now we got all,we need only to create the auto announces.

Add where you want,this:

Code: [Select]
new RandomANN[][] =
{
    "Announce 1",
    "Announce 2",
   "Announce 3"
};

Remember to DONT PUT THE , AT YOUR LAST ANNOUNCE!

And here we go,simple and easy.

4
Pawn Full Scripts / Re: [TUTORIAL]How to make simple logs for your server.
« on: February 09, 2011, 08:02:47 pm »
Thanks,i made it for Sa-Mp forum and pasted it here.

5
Pawn Code Snippets / Detect if player is flying
« on: February 09, 2011, 07:45:55 pm »
This is a simple stock to detect if player is using an heli/plane.

Code: [Select]
stock IsPlayerInFlying(playerid,vehicleid)
{

if(IsPlayerInVehicle(playerid,vehicleid))
{
switch(GetVehicleModel(vehicleid))
{
    case 487, 488, 497, 460,  476, 511, 512, 513, 519, 520,548,553,577,592,593:
    {
return true;
}
}
}
return false;
}

Credits to me.

6
Pawn Full Scripts / [TUTORIAL]How to make simple logs for your server.
« on: February 09, 2011, 07:44:05 pm »
Since i havent finded a tutorial board,i post here.

Hai all,this is my first tutorial so don't get mad if i will do something wrong.

And excuse my poor english,i'm Italian ^^.

Let's start:

What is this tutorial?

This tutorial is the simplest way to learn how to make logs in the fastest and simplest way.

For this tutorial,i will use the BanLog,to log all the admin bans in a file placed in /scriptfiles folder.

As first step,we need to create the forward statement:

Code: [Select]
forward BanLog(string[]);
Copy it in the first lines of your game mode.

Now we got the forward,we need to add the public() too.

So,let's add this:

Code: [Select]
public BanLog(string[])
{
new entry[128];
format(entry, sizeof(entry), "%s\n",string);
new File:hFile;
hFile = fopen("/LOGS/bans.log", io_append);
fwrite(hFile, entry);
fclose(hFile);
}

All public functions must be forwarded. That is a rule of pawno. If you do not forward a public function, you will receive warnings from the compiler. It's best to forward a function at the top of the script (but below the #include directives, though).

Let me describe what i write above:

Code: [Select]
new entry[128];
format(entry, sizeof(entry), "%s\n",string);

I used it for create a new string to write in the file.

the %s stays for the string to write in the file. (In this case,the ban).

\n is for create a new line.

And string,is for write ALL in the text file.

Code: [Select]
new File:hFile;
hFile = fopen("/LOGS/bans.log", io_append);
fwrite(hFile, entry);
fclose(hFile);

Here,we create the file place in /scriptfiles/LOGS/ called bans.log

WARNING: ALL FILES MUST BE IN /SCRIPTFILES FOLDER,PAWNO DOESNT HAVE ACCESS TO THE ROOT OF YOUR SERVER,SO YOU CANT CREATE FILES IN THE ROOT AND READING IT.

You can change the name/folder as you decided.

Ex: U can use only bans.log to access it in the only /scriptfiles folder,but i suggest to leave as is writed: /scriptfiles/LOGS.

NO NEED EVERYTIME TO WRITE /scriptfiles.

After the file is opened,the server will write it with:

Code: [Select]
fwrite(hFile, entry);
And after writing,it will be closed with:

Code: [Select]
fclose(hFile);
Well,we got now the forward and the public!

Now we need to add at your ban command,here is an example:


Code: [Select]
dcmd_b(playerid, params[])
{
        new toplayerid, reason[ 128 ];
        if (sscanf(params, "us[128]", toplayerid, reason))
        {
            SendClientMessage(playerid, 0xAA3333AA, "Syntax Error: /ban < Playerid > < Reason >");
            return 1;
        }
        if (toplayerid == INVALID_PLAYER_ID)
        {
            SendClientMessage(playerid, 0xAA3333AA, "Input Error: Player is not connected or it is yourself.");
            return 1;
        }
        new banString[128], adminName[24], bannedName[24];
        GetPlayerName(playerid, adminName, 24);
        GetPlayerName(toplayerid, bannedName, 24);
        format(banString, 128, "%s was banned by Admin %s. Reason: %s.", bannedName, adminName, reason);
        SendClientMessageToAll(0xAA3333AA, banString);
        BanLog(banString);
        Ban(toplayerid);
    }
    return 1;
}

As you can see,i've added the BanLog(banString) under:

       
Code: [Select]
format(banString, 128, "%s was banned by Admin %s. Reason: %s.", bannedName, adminName, reason);
        SendClientMessageToAll(0xAA3333AA, banString);
     
And we done.Simply uh?

WARNING: You need,when add BanLog to write the string used in the command.

Ex: In this case we used banString,if u use the normal string,u need to do:

        BanLog(string);

That's all,you can create all logs you want by using the forward and public writed above.

Sorry if tutorial is long but i've to describe the functions used ^^.

7
Member's Introduction / Hai pancakes
« on: February 09, 2011, 07:38:22 pm »
Hai all.

Pancakes 4 all.

Pages: [1]