[Tutorial] Getting a bonus for filling the kills table
#1


-Kills Table Bonus-

*This is my first ever tutorial,and also my first tutorial after a 6 months brake off scripting,so I still might have a few mistakes,just correct me if you spot them*


Well anyhow,I will teach you in here how give a play a bonus,if he has filled the kills table with his name
If you didn't understand,then you will see later what I mean,I don't have a picture right now since my SA:MP does not work,sorry for that.
Here we go:

Start by putting those variables on the top of your gamemode/filterscript;
pawn Code:
new TopKiller;
new TopKills = 0;
What do they mean?
TopKiller - the person who is the top killer(..)
TopKills - everytime the player kills someone,the TopKills will be increased by 1.Once the player has 5 TopKills ,he will fill the kills table and will get a bonus.

Now,put this code in the OnPlayerDeath public.
I will divide this code to 3 parts,and will explain to you about each and every part:
pawn Code:
if(killerid != TopKiller)
    {
        TopKiller = killerid;
        TopKills = 0;
    }
    TopKills++;
    if(TopKills == 5)
    {
        format(String,sizeof(String),"You have filled the kills board with your name and recived a 25000$ bonus!");
        SendClientMessage(playerid,0xFF0000DD,String);
        GivePlayerMoney(killerid,25000);
        TopKills = 0;
    }
Now to the explanation:

Part I
pawn Code:
if(killerid != TopKiller)
    {
        TopKiller = killerid;
        TopKills = 0;
    }
What does it do?
It checks if the last killer is another player,and if it is,it resets the previous top killer's kills to 0 and starts counting the new top killer kills.

Part II
pawn Code:
TopKills++;
Nothing much to explain,if the 'if' condition on the above does not exist (or whatever the right word is),then it adds +1 kill to the top killer kills count.

Part III
pawn Code:
if(TopKills == 5)
    {
        format(String,sizeof(String),"You have filled the kills board with your name and recived a 25000$ bonus!");
        SendClientMessage(playerid,0xFF0000DD,String);
        GivePlayerMoney(killerid,25000);
        TopKills = 0;
    }
This part is the most important part.
It checks if the Top Killer has reached a total kills of 5,.If he had,then it gives him the bonus + sends him a message about his achievement (of course that you can change the amount of money he gets,that's off-topic so I will not explain about that)

And that's pretty much it,I hope you like this tutorial
And again,if you spot any mistake or have any question,don't hesitate to ask
Greetings,Nuriel
Reply
#2

Nice tut
Reply
#3

Quote:
Originally Posted by Mr_Scripter
View Post
Nice tut
Thanks
Reply
#4

118 Views and No comments ... lol
Reply
#5

Quote:
Originally Posted by Mr_Scripter
View Post
118 Views and No comments ... lol
Yea that sucks >.>
I really hope I will get more comments soon cause I didnt make this tutorial for nothing..
Reply
#6

Very nice tutorial man.
Reply
#7

Quote:
Originally Posted by nuriel8833
View Post
Yea that sucks >.>
I really hope I will get more comments soon cause I didnt make this tutorial for nothing..
i hope you get more comments/reps then you will probally make more tutorials and i can learn more ...
Reply
#8

Quote:
Originally Posted by Kostas'
View Post
Very nice tutorial man.
Thanks
Reply
#9

Nice tutorial
Reply
#10

Nice tutorial.
Reply
#11

Quote:
Originally Posted by Rudy_
Посмотреть сообщение
Nice tutorial
Quote:
Originally Posted by cruteX_modshop
Посмотреть сообщение
Nice tutorial.
Thanks both
Reply
#12

Can you post screens of it if possible ?
Reply
#13

Quote:
Originally Posted by sniperwars
Посмотреть сообщение
Can you post screens of it if possible ?
I can't,I have problems with SA:MP
Maybe someone else can post a screenshot?
Reply
#14

For me this comes:

Код:
C:\Users\ilmar\Desktop\Eesti Fun Server\gamemodes\EEF1.pwn(2046) : error 017: undefined symbol "String"
C:\Users\ilmar\Desktop\Eesti Fun Server\gamemodes\EEF1.pwn(2046) : error 017: undefined symbol "String"
C:\Users\ilmar\Desktop\Eesti Fun Server\gamemodes\EEF1.pwn(2046) : error 029: invalid expression, assumed zero
C:\Users\ilmar\Desktop\Eesti Fun Server\gamemodes\EEF1.pwn(2046) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Did everything the same way.
Reply
#15

Quote:
Originally Posted by Hade.
Посмотреть сообщение
For me this comes:

Код:
C:\Users\ilmar\Desktop\Eesti Fun Server\gamemodes\EEF1.pwn(2046) : error 017: undefined symbol "String"
C:\Users\ilmar\Desktop\Eesti Fun Server\gamemodes\EEF1.pwn(2046) : error 017: undefined symbol "String"
C:\Users\ilmar\Desktop\Eesti Fun Server\gamemodes\EEF1.pwn(2046) : error 029: invalid expression, assumed zero
C:\Users\ilmar\Desktop\Eesti Fun Server\gamemodes\EEF1.pwn(2046) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Did everything the same way.
You need to define the new string before each format.

pawn Код:
new String[128];
Reply
#16

Lol, you're using a public variable instead of player variable.

You shall use:

pawn Код:
new TopKiller;
new TopKills[MAX_PLAYERS] = 0;
And TopKills is going to be like TopKills[playerid]. At least, if I'm not wrong, it counts the kills that each player makes? If yes, than that's how it shall look. Else, each time someone would kill, it would raise up, and even if they would have different ID's, the last guy who would make kill, he would get the whole cash.

Can't call this a tutorial. You can't make a tutorial in order to learn from it. If you want to learn, you better make filterscripts and basic systems, not tutorials.

EDIT: Nevermind all this post, sorry for bump, didn't see date.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)