Timer Score
#1

Hello,

How can i add Auto Timer SetScore +1 every 1 min set to players score +1 ?


______________________
Reply
#2

OnPlayerConnect:
pawn Код:
SetTimerEx("GiveScore", 60*1000, true, "i", playerid);
Somewhere in your script:
pawn Код:
forward GiveScore(playerid);
public GiveScore(playerid)
{
    SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
}
Reply
#3

easy. code:

pawn Код:
public OnPlayerConnect(playerid)
{
     SetTimerEx("score", 5000, true, "i", playerid);
     return 1;
}


forward score(playerid);
public score(playerid)
{
     SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
}
Try that.
Reply
#4

Help

T:\My Documents\Pilot\gamemodes\pilot2.pwn(315) : error 029: invalid expression, assumed zero
T:\My Documents\Pilot\gamemodes\pilot2.pwn(315) : error 017: undefined symbol "GiveScore"
T:\My Documents\Pilot\gamemodes\pilot2.pwn(316) : error 029: invalid expression, assumed zero
T:\My Documents\Pilot\gamemodes\pilot2.pwn(316) : error 017: undefined symbol "GiveScore"
T:\My Documents\Pilot\gamemodes\pilot2.pwn(31 : error 017: undefined symbol "playerid"

Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Reply
#5

What about lines?
Reply
#6

Thanks i will try!
Reply
#7

Quote:
Originally Posted by Clive
Посмотреть сообщение
OnPlayerConnect:
pawn Код:
SetTimerEx("GiveScore", 60*1000, true, "i", playerid);
Somewhere in your script:
pawn Код:
forward GiveScore(playerid);
public GiveScore(playerid)
{
    SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
}
>> Thanks best
>> But if i exit and come back score is removed :S
Reply
#8

Quote:
Originally Posted by [M.A]Angel[M.A]
Посмотреть сообщение
>> Thanks best
>> But if i exit and come back score is removed :S
You need to save the score to file:
pawn Код:
CMD:savemyscore( playerid, params[ ] ) {
    new file[ 256 ], name[ 24 ]; GetPlayerName( playerid, name, 24 ); format( file, sizeof file, "somefolder/%s.ini", name );
    new INI:PlayerAcc = INI_Open( file ); INI_WriteInt( PlayerAcc, "Score", GetPlayerScore( playerid ) ); INI_Close( PlayerAcc );
    return SendClientMessage( playerid, 0xAAAAAA, "Your score has been saved to file" );
}
Saves your score to file^^. Uses Y_INI.
Reply
#9

Is there another way eazly?
Reply
#10

Quote:
Originally Posted by Mean
Посмотреть сообщение
You need to save the score to file:
pawn Код:
CMD:savemyscore( playerid, params[ ] ) {
    new file[ 256 ], name[ 24 ]; GetPlayerName( playerid, name, 24 ); format( file, sizeof file, "somefolder/%s.ini", name );
    new INI:PlayerAcc = INI_Open( file ); INI_WriteInt( PlayerAcc, "Score", GetPlayerScore( playerid ) ); INI_Close( PlayerAcc );
    return SendClientMessage( playerid, 0xAAAAAA, "Your score has been saved to file" );
}
Saves your score to file^^. Uses Y_INI.
Success thanks, but OnPlayerConnect Load score how? ||| FIXED |||
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)