Player Score
#1

What is a command i put put into my script so every game hour a player gets 2 score? And 200 $?
Reply
#2

you create a function that gives a player +2 score and $200 and then use a timer to execute it every game hour
Reply
#3

On the top of your script
pawn Код:
forward GiveScoreMoney(playerid);
OnGameModeInIt
pawn Код:
public OnGameModeInIt()
{
     SetTimer("GiveScoreMoney",x,true);//Replace x with the time you want
     return 1;
}
Replace x with the time you want
Now
The public

pawn Код:
public GiveScoreMoney(playerid)
{
    SetPlayerScore(playerid,GetPlayerScore(playerid) + 2);
    GivePlayerMoney(playerid,200);
    return 1;
}
Reply
#4

i dont think the onee before will work as it wont pass the playerid right idea though
pawn Код:
public GiveScoreMoney()
{
    for(new i=0;i<MAX_PLAYERS;i++){
        if(!IsPlayerConnected(i))continue;
        SetPlayerScore(i,GetPlayerScore(playerid) + 2);
        GivePlayerMoney(i,200);
    }
    return 1;
}
this should do it
and a standard game hour is 1min so your time would be 60000
Reply
#5

No, both of u wrong...

pawn Код:
public OnGameModeInit( )
{
    SetTimer( "ScoreMoney", 60 * 60000, 1 );
    return 1;
}

forward ScoreMoney( ); // You don't need the "playerid" param here, leave it empty.
public ScoreMoney( )
{
    for( new i = 0; i < MAX_PLAYERS; i++ )
    {
        if( IsPlayerConnected( i ) )
            GivePlayerMoney( i, 200 ),
            SetPlayerScore( i, GetPlayerScore( i ) + 2 );
    }
    return 1;
}
Reply
#6

your right on the playerid teach me for editing lol
but 60 * 60000 is a real hour not a game hour
Reply
#7

LOL fails ... doesnt matter will work anyways ... works on every script I tested
Reply
#8

Thanks Guy, Testing now
Reply
#9

Did not work
Reply
#10

pawn Код:
public OnGameModeInit( )
{
    SetTimer( "ScoreMoney", 24 * 60 * 1000, true);//thats like a whole day in game
    return 1;
}

forward ScoreMoney();
public ScoreMoney()
{
    foreach(Player, i)
    {
         if(!IsPlayerConnected(i)) continue;
         GivePlayerMoney(i, 200);  
         SetPlayerScore(i, GetPlayerScore(i) + 2);
    }
}
using foreach, i dont see whats possibly wrong?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)