Driving Score - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Driving Score (
/showthread.php?tid=114782)
Driving Score -
rs2fun111 - 20.12.2009
Got Resolved Problem
Thank You All For The Help Atleast I Got it to Work.
Re: Driving Score -
PANNA - 20.12.2009
like this?
https://sampwiki.blast.hk/wiki/SetTimer
Re: Driving Score -
rs2fun111 - 20.12.2009
i tryd but it wont work
Re: Driving Score -
rs2fun111 - 20.12.2009
do i have made script like this?
Код:
forward vehicleminutescore();
public OnGameModeInit( )
{
print("Starting Every Minute Driving Score");
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 520)
SetTimer("vehicleminutescore",1000,false);
}
public vehicleminutescore()
{
print("1 minute has passed.");
SetPlayerScore(playerid,score+1);
}
Re: Driving Score -
Vetle - 20.12.2009
erm, playerid who?
pawn Код:
//Top
gInHydra[MAX_PLAYERS];
gPlayerTimer[MAX_PLAYERS];
forward AddScore(playerid);
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 520)
{
gPlayerTimer[playerid] = SetTimerEx("AddScore", 60000, true, "%i", playerid);
}
}
if(newstate == PLAYER_STATE_ONFOOT)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 520)
{
KillTimer(gPlayerTimer[playerid]);
}
}
return 1;
}
public AddScore(playerid)
{
SetPlayerScore(playerid, GetPlayerScore(playerid)+1);
return 1;
}
Re: Driving Score -
rs2fun111 - 20.12.2009
i got there errors =S
Код:
D:\GTA San Andreas\gamemodes\kfs.pwn(2) : error 010: invalid function or declaration
D:\GTA San Andreas\gamemodes\kfs.pwn(97) : warning 217: loose indentation
D:\GTA San Andreas\gamemodes\kfs.pwn(356) : warning 217: loose indentation
D:\GTA San Andreas\gamemodes\kfs.pwn(431) : warning 202: number of arguments does not match definition
D:\GTA San Andreas\gamemodes\kfs.pwn(497) : error 017: undefined symbol "gPlayerTimer"
D:\GTA San Andreas\gamemodes\kfs.pwn(497) : warning 215: expression has no effect
D:\GTA San Andreas\gamemodes\kfs.pwn(497) : error 001: expected token: ";", but found "]"
D:\GTA San Andreas\gamemodes\kfs.pwn(497) : error 029: invalid expression, assumed zero
D:\GTA San Andreas\gamemodes\kfs.pwn(497) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
5 Errors.
Re: Driving Score -
[HiC]TheKiller - 20.12.2009
You would be better adding the seconds into a variable so you can get the exact time.
pawn Код:
new InSeconds[MAX_PLAYERS];
new InMinutes[MAX_PLAYERS];
new PlayerTimer[MAX_PLAYERS];
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 520)
{
PlayerTimer[playerid] = SetTimerEx("Score", 1000, true, "%i", playerid);
}
}
if(newstate == PLAYER_STATE_ONFOOT)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 520)
{
KillTimer(PlayerTimer[playerid]);
}
}
return 1;
}
forward Score(playerid);
public Score(playerid)
{
InSeconds[playerid] ++;
if(InSeconds[playerid] == 60)
{
InMinutes[playerid] ++;
InSeconds[playerid] = 0;
}
return 1;
}
Re: Driving Score -
rs2fun111 - 20.12.2009
now comes only 1 error hmm
Код:
D:\GTA San Andreas\gamemodes\vehiclescore60.pwn(10) : error 001: expected token: ";", but found "public"
D:\GTA San Andreas\gamemodes\vehiclescore60.pwn(57) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Re: Driving Score -
rs2fun111 - 20.12.2009
I Have FilterScript Like This But if i drive a hydra in minute then its not adding score +1 hmm .
FilterScript:
Код:
#define FILTERSCRIPT
#include <a_samp>
#if defined FILTERSCRIPT
new InSeconds[MAX_PLAYERS];
new InMinutes[MAX_PLAYERS];
new PlayerTimer[MAX_PLAYERS];
public OnFilterScriptInit()
{
print("Vehicle Score Added");
return 1;
}
#else
main()
{
}
#endif
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 520)
{
PlayerTimer[playerid] = SetTimerEx("Score", 1000, true, "%i", playerid);
}
}
if(newstate == PLAYER_STATE_ONFOOT)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 520)
{
KillTimer(PlayerTimer[playerid]);
}
}
return 1;
}
forward Score(playerid);
public Score(playerid)
{
InSeconds[playerid] ++;
if(InSeconds[playerid] == 1)
{
InMinutes[playerid] ++;
InSeconds[playerid] = 1;
}
return 1;
}
Re: Driving Score -
Marcel - 20.12.2009
Just do this:
pawn Код:
forward HydraScore();
OnFilterScriptInit:
SetTimer("HydraScore", 60000, true);
public HydraScore()
{
for(new i=0; i<MAX_PLAYERS; i++ )
{
if(GetVehicleModel(GetPlayerVehicleID(i)) == 520)
{
SetPlayerScore(i, GetPlayerScore(i)+1);
}
}
return 1;
}