PDA

View Full Version : 1 score every 1 Min


Abanob
25/07/2013, 09:18 PM
I need a good COde For 1 Score every 1 min play in the server , I search before but every time the code give error in compline



here is the found Code But its Not working


new seconds[MAX_PLAYERS];
public OnGameModeInit()
{
SetTimer("scoretimer", 1000, true);
return 1;
}
public OnPlayerConnect(playerid)
{
seconds[playerid] = 0;
return 1;
}


forward scoretimer();
public scoretimer()
{
for(new i; i<MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
seconds[i] ++;
if(seconds[i] == 60)
{
SetPlayerScore(i, GetPlayerScore(i) + 1);
seconds[i] = 0;
}
}
return 1;
}

Vanter
25/07/2013, 10:27 PM
whats the error?

Binx
25/07/2013, 10:27 PM
Here, try this:
//Top of script
new seconds[MAX_PLAYER_NAME];
//Under OnGameModeInit
SetTimer("score", 1000, 1);
//Under OnPlayerConnect
seconds[playerid] = 0;
// Timer
// Add anywhere in the script
forward score(playerid);
new score(playerid)
{
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
}
return 1;
}

Abanob
25/07/2013, 11:20 PM
C:\Users\saif\Documents\score1.pwn(12) : error 017: undefined symbol "MAX_PLAYER_NAME"
C:\Users\saif\Documents\score1.pwn(4) : error 010: invalid function or declaration
C:\Users\saif\Documents\score1.pwn(6) : error 010: invalid function or declaration
C:\Users\saif\Documents\score1.pwn(10) : error 001: expected token: ";", but found "("
C:\Users\saif\Documents\score1.pwn(12) : error 010: invalid function or declaration
C:\Users\saif\Documents\score1.pwn(12 -- 14) : error 010: invalid function or declaration
C:\Users\saif\Documents\score1.pwn(12 -- 16) : warning 203: symbol is never used: "SetPlayerScore"
C:\Users\saif\Documents\score1.pwn(12 -- 16) : warning 203: symbol is never used: "score"
C:\Users\saif\Documents\score1.pwn(12 -- 16) : warning 203: symbol is never used: "seconds"
C:\Users\saif\Documents\score1.pwn(12 -- 16) : error 013: no entry point (no public functions)
C:\Users\saif\Documents\score1.pwn(12 -- 16) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


8 Errors.



error again

and I need /server and /drift commands (If U can and Thanks)

Paglia
25/07/2013, 11:23 PM
This will be very easy, under OnPlayerUpdate function (updates every second) type this:

SetPlayerScore(playerid,GetPlayerScore(playerid) + 1;

ThePhenix
25/07/2013, 11:27 PM
This will be very easy, under OnPlayerUpdate function (updates every second) type this:

SetPlayerScore(playerid,GetPlayerScore(playerid) + 1;


You're wrong. OnPlayerUpdate function doesn't updated every second, it updates maybe like 30 times a SECOND.

Abanob
25/07/2013, 11:29 PM
You're wrong. OnPlayerUpdate function doesn't updated every second, it updates maybe like 30 times a SECOND.

So what it Should be ?

Paglia
25/07/2013, 11:31 PM
sorry my bad

Abanob
25/07/2013, 11:35 PM
Same error

C:\Users\saif\Documents\score1.pwn(12) : error 017: undefined symbol "MAX_PLAYER_NAME"
C:\Users\saif\Documents\score1.pwn(4) : error 010: invalid function or declaration
C:\Users\saif\Documents\score1.pwn(6) : error 010: invalid function or declaration
C:\Users\saif\Documents\score1.pwn(10) : error 001: expected token: ";", but found "("
C:\Users\saif\Documents\score1.pwn(12) : error 054: unmatched closing brace ("}")
C:\Users\saif\Documents\score1.pwn(12 -- 14) : error 010: invalid function or declaration
C:\Users\saif\Documents\score1.pwn(12 -- 16) : warning 203: symbol is never used: "SetPlayerScore"
C:\Users\saif\Documents\score1.pwn(12 -- 16) : warning 203: symbol is never used: "score"
C:\Users\saif\Documents\score1.pwn(12 -- 16) : warning 203: symbol is never used: "seconds"
C:\Users\saif\Documents\score1.pwn(12 -- 16) : error 013: no entry point (no public functions)
C:\Users\saif\Documents\score1.pwn(12 -- 16) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


8 Errors.

ThePhenix
25/07/2013, 11:37 PM
public OnGameModeInit()
{
SetTimer("givescore", 60000, 1);
return 1;
}

forward givescore();
public givescore()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
SetPlayerScore(i, GetPlayerScore(i) +1);
}
return 1;
}

Abanob
25/07/2013, 11:39 PM
public OnGameModeInit()
{
SetTimer("givescore", 60000, false);
return 1;
}

forward givescore();
public givescore()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
SetPlayerScore(i, GetPlayerScore(i) +1);
}
return 1;
}



-_-

C:\Users\saif\Documents\score1.pwn(1) : warning 235: public function lacks forward declaration (symbol "OnGameModeInit")
C:\Users\saif\Documents\score1.pwn(3) : error 017: undefined symbol "SetTimer"
C:\Users\saif\Documents\score1.pwn(10) : error 017: undefined symbol "MAX_PLAYERS"
C:\Users\saif\Documents\score1.pwn(12) : error 017: undefined symbol "SetPlayerScore"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


3 Errors.

Scaleta
25/07/2013, 11:42 PM
You didn't include a_samp.

ThePhenix
25/07/2013, 11:42 PM
-_-

C:\Users\saif\Documents\score1.pwn(1) : warning 235: public function lacks forward declaration (symbol "OnGameModeInit")
C:\Users\saif\Documents\score1.pwn(3) : error 017: undefined symbol "SetTimer"
C:\Users\saif\Documents\score1.pwn(10) : error 017: undefined symbol "MAX_PLAYERS"
C:\Users\saif\Documents\score1.pwn(12) : error 017: undefined symbol "SetPlayerScore"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


3 Errors.

Update your samp server folder!

Matnix
25/07/2013, 11:43 PM
You got these error because you didn't add #include <a_samp> in the top of your script.


C:\Users\J-THOMAS\Desktop\Serveur\filterscripts\oke.pwn(1) : warning 235: public function lacks forward declaration (symbol "OnGameModeInit")
C:\Users\J-THOMAS\Desktop\Serveur\filterscripts\oke.pwn(3) : error 017: undefined symbol "SetTimer"
C:\Users\J-THOMAS\Desktop\Serveur\filterscripts\oke.pwn(10) : error 017: undefined symbol "MAX_PLAYERS"
C:\Users\J-THOMAS\Desktop\Serveur\filterscripts\oke.pwn(12) : error 017: undefined symbol "SetPlayerScore"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



#include <a_samp>

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");

SetTimer("givescore", 60000, false);
return 1;
}

forward givescore();
public givescore()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
SetPlayerScore(i, GetPlayerScore(i) +1);
}
return 1;
}

Scaleta
25/07/2013, 11:44 PM
Update your samp server folder!

No, just no.

Abanob
26/07/2013, 12:00 AM
You got these error because you didn't add #include <a_samp> in the top of your script.


C:\Users\J-THOMAS\Desktop\Serveur\filterscripts\oke.pwn(1) : warning 235: public function lacks forward declaration (symbol "OnGameModeInit")
C:\Users\J-THOMAS\Desktop\Serveur\filterscripts\oke.pwn(3) : error 017: undefined symbol "SetTimer"
C:\Users\J-THOMAS\Desktop\Serveur\filterscripts\oke.pwn(10) : error 017: undefined symbol "MAX_PLAYERS"
C:\Users\J-THOMAS\Desktop\Serveur\filterscripts\oke.pwn(12) : error 017: undefined symbol "SetPlayerScore"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



#include <a_samp>

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");

SetTimer("givescore", 60000, false);
return 1;
}

forward givescore();
public givescore()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
SetPlayerScore(i, GetPlayerScore(i) +1);
}
return 1;
}


Best Answer Thanks :D