+- +-

+-User

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+-Stats ezBlock

Members
Total Members: 82
Latest: justinfloyd
New This Month: 0
New This Week: 0
New Today: 0
Stats
Total Posts: 50
Total Topics: 23
Most Online Today: 29
Most Online Ever: 34
(June 22, 2021, 04:58:42 am)
Users Online
Members: 0
Guests: 21
Total: 21

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.


Topics - Marsigne

Pages: 1
1
General Talk / Coming Back :P
« on: February 22, 2013, 08:29:47 am »
Well, well, I remembered this site again, by the same situation as before :O I must keep a brain keeper or something, btw what is new here guys?

2
General Talk / looong time dudes
« on: November 07, 2012, 06:40:38 pm »
I think I left this server for 3 or 4 months, sorry dudes :( it was because I forgot :O What made me remember is when I entered dot.tk and entered my account and I saw the unstunting.tk domain LOL

3
Wtf ? "Sorry, you can't repeat a karma action without waiting 9999999 hours."

EDIT BY SAGAR: Actully i was thinking that per player can give only %s player only 1 repuation but fixed : thanks

LOCKED :

4
Introductions / Introducing myself and saying why am I here.
« on: May 19, 2012, 11:16:45 pm »
Well, First, the introduction. My name is Michael Angelo L?pez Marsign?. I am 13 years old. Saying hello to the server. First, let's start from the beginning. I saw some users that didn't had forum, so my idea was to put a post to make a forum for someone with .tk domain, and I did. After some posts, I received a PM. The subject was "i need one !!!!!" by HaZaRaS? (AKA [hs]handsom_sagar). The PM was actually that he had a forum and he wanted to make his forum a .tk domain, but that wasen't actually that I was thinking. But, I wanted to help HaZaRaS?. I replied with "You want me to create a forums for you? Another? I can make you one with SMF and .tk domain." And he replied "i have .smffy.com .. so how can i put .tk ??". Then I replied (this reply is why I am developer) "It is easy, but I must be administrator to get in administration area and apply an .tk domain." And it was actually right. But cutting the other PM's, the result was that he had to get to host to change domain and if he did not had host, he had to make a new forum. The whole thing is that this forum doesn't support a domain manager, but the forum I create, I put a domain manager that the domain can be edited easily. But I will be searching for information, is the now answer. Now, you know why I am here.

5
First step

In the first step I will show how to create a global variable that will control (and will be needed) the constants and the timer.
Now we will add this at the top of the script. Warning: must be on top of script but not above a_samp!! or else will give error. why on the top of the script? to make it a GLOBAL variable.

Code: [Select]
new GiveScoreTimer[MAX_PLAYERS];
with this new global variable we will control the score timer. the [MAX_PLAYERS] consist that will be to entire players (in other words, up to max players)
Warning: The new global variable must be at the end with the ; (semi colon). why? it is self explanatory, it is like the sentence. it finish the lines, or else it wont finish and will ruin an error.

Second step

In the second step I will show how to convert a variable to a timer and explain the functions.

Code: [Select]
GiveScoreTimer[playerid] = SetTimerEx ("GivePlayerScore", 1000*60, true, "d", playerid);
Now we converted the variable into a timer. I will explain the steps.

Code: [Select]
GiveScoreTimer[playerid]
The GiveScoreTimer is the variable, but you say, why playerid there?  well, playerid is for the player, but this works DEPENDING on where you put it to work. We will show later where will be put.

Code: [Select]
SetTimerEx ("GivePlayerScore", 1000*60, true, "d", playerid);
This is the converted timer. "GivePlayerScore" tells which variable will be used for the timer. the 1000*60 is 1000 x 60 = 60,000 that is 60 seconds in decimal. "true" is self explanatory. and playerid is for the player DEPENDING where you put it.

Third step

In the third step I will show where to put it and WHY put it there. As i said before, the playerid works DEPENDING on where you put it, now I will show you where to put it. Why to put it there? because there will work the playerid FOR all players.

Code: [Select]
public OnPlayerConnect(playerid)
{
    return 1;
}

Here you will put your converted timer so once the player connects the timer will run FOR the player (playerid). Now understand why playerid here, right? Now, we will do this....

Code: [Select]
public OnPlayerConnect(playerid)
{
    GiveScoreTimer[playerid] = SetTimerEx ("GivePlayerScore", 1000*60, true, "d", playerid);
    return 1;
}

Yes, put the converted timer above the return 1;. why? self explanatory, must be the timer before the public constant returns. if you put it after the return, it will return, THEN it will do the timer, so, it will be nothing.

Fourth step

In the fourth step I will show how to stop the timer once the player disconnects.
Now you will ask, but? when the timer stops? I tell you, It won't stop! But don't die, this can be fixed with just 1 constant!
go to here...

Code: [Select]
public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

Here is the part when the player disconnect. Now you say, How I stop it? Which constant? Wait, let me talk, I will do it just right now.

Code: [Select]
KillTimer(GiveScoreTimer[playerid]);
This constant is to "Kill" the timer, in other words, it stop the timer.
Now, We will do this...

Code: [Select]
public OnPlayerDisconnect(playerid, reason)
{
    KillTimer(GiveScoreTimer[playerid]);
    return 1;
}

As I told before, it must be above the return, so it can return.

Fifth step

In the fourth step I will show to do a "score" in each minute. and of course, where.
Now you say, but... What will give me once a minute? Nothing? Wait, let me do the last step, to do the function to do a "score" every minute as I set it up on the timer.

Now in this part, we will do a forward, because we will make a custom function.
Let's go up all the script and put this....

Code: [Select]
forward GivePlayerScore(playerid);
Here this function will forward the public function. after you do this, as this is a public function, you can put this everywhere you put it DOWN (of course) the global variable and the a_samp. Here it is the code...

Code: [Select]
public GivePlayerScore(playerid)
{
    return 1;
}

Here we created the public function. Now here will set up the player score every minute as set up on the timer.

Now we will do this....

Code: [Select]
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
Now I will explain these steps.

Code: [Select]
SetPlayerScore
Here we "set" the player score to something... Let's follow...

Code: [Select]
(playerid, GetPlayerScore(playerid) + 1)
The playerid, of course, is to give the score to the player. and GetPlayerScore(playerid) + 1 is to give +1 score to the player.

Conclusion:
Nice tutorial, huh? Here I showed you how to create a score system. You can comment, You can suggest me to do other scripts, and I will do others too!

Pages: 1

+-Recent Topics

UNS Is Back But Still under Construction. by мυ∂υℓ_вacнα
January 30, 2014, 07:21:59 am

Coming Back :P by мυ∂υℓ_вacнα
March 09, 2013, 12:49:18 pm

How to make a score system [1 score every minute] by мυ∂υℓ_вacнα
February 24, 2013, 01:59:25 am

[Forum Report]Reputation charge wait time 99999 hours? by мυ∂υℓ_вacнα
February 24, 2013, 01:56:27 am

[UNIVERSAL 2013 Update]: Server Has Been Update To 0.3x ... An Brand New Changes by Smokie
February 04, 2013, 03:32:21 pm

looong time dudes by мυ∂υℓ_вacнα
December 08, 2012, 12:54:21 pm

[UNIVERSAL 2012 UPDATE]:- Server Has Been Updated To 0.3e R-2 And Stuff ADDED : by мυ∂υℓ_вacнα
October 14, 2012, 01:35:41 am

Idiot by Gamer
June 17, 2012, 01:28:45 am

Universal House info-Center. by Marsigne
June 05, 2012, 08:32:12 pm

[Universal Vedios] : Universal Stutning Vedio. by Smokie
June 05, 2012, 06:58:46 am