beginner race server

Started by habi, Feb 17, 2020, 04:40 PM

Previous topic - Next topic

habi

#15
here you go https://drive.google.com/file/d/1GG4VdXgDZ4ffkOo-sDZlpknQpit30Uy5/view?usp=sharing  (Complete Windows 32 / 64)

to make it all neat and simple, I have put all functions into a new file race.nut
Earlier you had to add some 100 lines. Now just add these lines
1. onScriptLoad()
dofile("scripts/race.nut");onRaceScriptLoad();
2. onPlayerPart( player, reason )
onRacePlayerPart( player, reason );
3. onPlayerDeath( player, reason )
onRacePlayerDeath( player, reason );
4. onPlayerKill( player, killer, reason, bodypart )
onRacePlayerKill( player, killer, reason, bodypart );
5. onPlayerTeamKill( player, killer, reason, bodypart )
onRacePlayerTeamKill( player, killer, reason, bodypart );
6. onCheckpointEntered()
function onCheckpointEntered( player, checkpoint )
{
onRaceCheckpointEntered( player, checkpoint );
}

7. onPlayerCommand,
function onPlayerCommand( player, cmd, text )
{
if (cmd =="cmds")
{
MessagePlayer("[#C0C0C0]!race !stoprace !list",player);
}else if( IsRaceCommand( cmd ) )   
{
onPlayerRaceCommand( player, cmd, text );
}
return;
}

only race.nut and sound files -->  https://drive.google.com/file/d/1BkaglFbpgrzOg40dcFq8KSNTfu779QVC/view?usp=sharing

Sebastian

This is the best way.
Congratz habi!

habi

#17
thanks . i have seen it today only.

EnForcer


gtacheng

AN ERROR HAS OCCURED [the index 'Name' does not exist]

CALLSTACK
*FUNCTION [onPlayerRaceCommand()] scripts/race.nut line [51]

SHy^

Quote from: GTA-Cheng on Aug 14, 2020, 09:01 AMAN ERROR HAS OCCURED [the index 'Name' does not exist]

CALLSTACK
*FUNCTION [onPlayerRaceCommand()] scripts/race.nut line [51]
Post the error line.

habi

#21
well, i myself looked into it and found it is a bug.

Thanks GTA-Cheng for finding it

Change line 51 to
if(player.Name!=author)return;
Also change line 41 to
if(player.Name!=author)return;
(There was a author.Name which caused problem. Now fixed )

Also there is a change in line 96
if(a>0 && a<=race_list.len())name=race_list[a-1];( this '<=' is required )

I will update the files above.

gtacheng

Thank you for this great job, I like him!!! ;)