Need help with 1 function. +1 rep for help.
#1

This is the function

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if (killerid != playerid) {
        if (GetPlayerExpLevel(playerid) < GetPlayerExpLevel(killerid))
        {
            GivePlayerExp(killerid, -15, "Jums dingo 15 exp uz nuzudima!");
        }
        else if (GetPlayerExpLevel(playerid) > GetPlayerExpLevel(killerid))
        {
            GivePlayerExp(killerid, -15, "Jums dingo 15 exp uz nuzudima!");
        }
        else
        {
            GivePlayerExp(killerid, -15, "Jums dingo 15 exp uz nuzudima!");
        }
    }
    return 1;
}
This is a principle of everything.
Ok how to make to get 2 exp per 3 minutes? And i need to make it on score board too...
Well this function called OnPlayerDeath is not necessary
Reply
#2

Do you want every player 3 minutes by adding 2 or like all in-game players in 3 minutes?
Reply
#3

Quote:
Originally Posted by BrandyPenguin
Посмотреть сообщение
Do you want every player 3 minutes by adding 2 or like all in-game players in 3 minutes?
I want to get 1 expierence points (exp) per 3 minutes...
Reply
#4

This should work, it's not tested though so no guarentees

pawn Код:
forward ExpTimer(); // Forward the timer callback

public ExpTimer() { // The timer callback
for(new i = 0; i < MAX_PLAYERS; i++) { // Loop
if(IsPlayerConnected(playerid)) {
GivePlayerExp(killerid, 3, "+1 EXP"); // Every connected player receives 1 EXP
}
}
}

public OnGameModeInit() {
SetTimer("ExpTimer", 180000, true); // Repeating timer set when the server starts up
}
- Shoulen
Reply
#5

Quote:
Originally Posted by Shoulen
Посмотреть сообщение
This should work, it's not tested though so no guarentees

pawn Код:
forward ExpTimer(); // Forward the timer callback

public ExpTimer() { // The timer callback
for(new i = 0; i < MAX_PLAYERS; i++) { // Loop
if(IsPlayerConnected(playerid)) {
GivePlayerExp(killerid, 3, "+1 EXP"); // Every connected player receives 1 EXP
}
}
}

public OnGameModeInit() {
SetTimer("ExpTimer", 180000, true); // Repeating timer set when the server starts up
}
- Shoulen
Under IsPlayerConnected(playerid) should be IsPlayerConnected(i)). playerid isn't even defined.
Reply
#6

The whole script is causing errors. For example 'killerid' isn't defined either and the script gives the player 3 experience instead of one.

This should be correct:
Код:
forward ExpTimer(); // Forward the timer callback

public ExpTimer()  // The timer callback
{ 
	for(new i = 0; i != MAX_PLAYERS; i++) 
	{ // Loop
		if(IsPlayerConnected(i) && !IsPlayerNPC(i)) // Checks if player is connected + NPC's don't need experience
		{
			GivePlayerExp(i, 1, "+1 EXP"); // Every connected player receives 1 EXP
		}	
	}
	return 1;
}

public OnGameModeInit() 
{
	SetTimer("ExpTimer", 180000, true); // Repeating timer set when the server starts up
}
Reply
#7

+1 rep for all who tryed to help me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)