[Include] Dynamic race system (Can also be used for missions!)
#1

Hello!

I've decided to release my race system, so here you go I haven't been testing it for a long time though, so feel free to leave any suggestions
  • Requirements
You will need the following plugins/includes to use this script:
  • Usage
I have made it simple to use with any command processor by making functions that you can call in your commands like so:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[ ])
{
    if(!strcmp(cmdtext, "/mycommandhere"))
    {
        return LR_CMD_RACECARS(playerid);
    }
}
Or (Depending on your command processor)
pawn Код:
CMD:mycommandhere(playerid, params[])
{
    return LR_CMD_RACECARS(playerid);
}
  • Callbacks
I will put these into two different categories, one named base and one named optional. Base means they're required to be called in the script for the thing to work, optional means they can be used if you want them.
  • Base
  • LR_LoadRaces() - Has to be called OnGameModeInit
  • LR_OnPlayerEnterRaceCheckpoint(playerid)
  • LR_OnDialogResponse(playerid, dialogid, response, listitem)
  • Optional
  • IsVehicleAllowedInRace(model, raceid)
  • LR_CMD_ADDRACE(playerid, params[])
  • LR_CMD_ADDCHECKPOINT(playerid, params[])
  • LR_CMD_LOADRACEFORALL(playerid)
  • LR_CMD_LOADRACEFORPLAYER(playerid)
  • LR_CMD_JOINRACE(playerid)
  • LR_CMD_LEAVERACE(playerid)
  • LR_CMD_READY(playerid)
  • LR_CMD_READYALL()
  • LR_CMD_RACECARS(playerid)
  • Download
Include
SQL schema
Reply
#2

Nice althought i don't suggest to use mysql for a race system, especially to store checkpoint coords (there are also users that cannot administrate their own database, or simply don't want)
Maybe create another version that stores coords simply in a txt files
Anyway nice job
Reply
#3

Yes, I might add a define and work with textfiles if this turns out to be popular, I only put it here to share though since I don't mind it being used outside my private server
Reply
#4

Looking very nice!
But can you make it on a normal text file, without MYSQL?
Btw, how to make a beautiful ASCII text like that!

Quote:
Originally Posted by Pantho90
(there are also users that cannot administrate their own database, or simply don't want)
^
|
|
Reply
#5

I used phpMyAdmin to export the tables
Reply
#6

Thanks for the release. =]
Reply
#7

Quote:
Originally Posted by Phanto90
Посмотреть сообщение
Nice althought i don't suggest to use mysql for a race system, especially to store checkpoint coords (there are also users that cannot administrate their own database, or simply don't want)
Maybe create another version that stores coords simply in a txt files
Anyway nice job
i dont see why, mysql was made to store thousands of rows?

i have a 360,000 row table. it takes like 75 ms to select from it, nothing to much.

anyways, got any videos :P?
Reply
#8

Quote:
Originally Posted by Donya
Посмотреть сообщение
i dont see why, mysql was made to store thousands of rows?

i have a 360,000 row table. it takes like 75 ms to select from it, nothing to much.

anyways, got any videos :P?
You are absolutely right, but many users don't even know what is a database, so the "public release range" will be less than with a second release with a modifyied system. I'm not suggesting to delete what he has done, but modify and release a second version that supports .txt files

And consider that you should have a dabatase running on the same machine where your running samp server if you want good timing result and not all host offer this possibility.
Reply
#9

Hmm, can anyone make a test filterscript?
I don't really understand how it works.
Reply
#10

Quote:
Originally Posted by Phanto90
Посмотреть сообщение
You are absolutely right, but many users don't even know what is a database, so the "public release range" will be less than with a second release with a modifyied system. I'm not suggesting to delete what he has done, but modify and release a second version that supports .txt files

And consider that you should have a dabatase running on the same machine where your running samp server if you want good timing result and not all host offer this possibility.
hmm, i guess so. mysql does slow down while selecting from a home server. a .txt support will be good too, for other users i guess.

good work anyways!
Reply
#11

This looks nice, an Include for racing is amazing. In mysql is great, though i really want to know if mysql can select rows/columns faster than SQLite.

Good work made, hope to see more from you
Reply
#12

I Get some errors and Warnings:


Код:
error 001: expected token: ";", but found "-string-"
warning 215: expression has no effect
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
All on this line (Not edited)

Код:
sscanf("-1%""%""%""%0", "p<%>e<is[" #MAX_RACE_NAME "]s[41]s[" #MAX_PLAYER_NAME "]i>", Race[i]);
Reply
#13

Nice system, looking forward to the txt file supported version. Great job.
Reply
#14

Quote:
Originally Posted by Gforcez
Посмотреть сообщение
I Get some errors and Warnings:


Код:
error 001: expected token: ";", but found "-string-"
warning 215: expression has no effect
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
All on this line (Not edited)

Код:
sscanf("-1%""%""%""%0", "p<%>e<is[" #MAX_RACE_NAME "]s[41]s[" #MAX_PLAYER_NAME "]i>", Race[i]);
Yes, sorry, I forgot I re-defined MAX_PLAYER_NAME since it contains ( ) which isn't allowed in sscanf. It's fixed in the pastebin version now, I also added a missing timer and compiled it to an empty gamemode make sure it all works
Reply
#15

can you run multiple races?
Reply
#16

Quote:
Originally Posted by Lenny the Cup
Посмотреть сообщение
Yes, sorry, I forgot I re-defined MAX_PLAYER_NAME since it contains ( ) which isn't allowed in sscanf. It's fixed in the pastebin version now, I also added a missing timer and compiled it to an empty gamemode make sure it all works
Thanks Mate!
Reply
#17

ehm.... how do I install this? Im new with mysql (downloaded it 5 mins ago)
How do i install the includes etc? Help please
Reply
#18

Quote:
Originally Posted by Gemini
Посмотреть сообщение
can you run multiple races?
Yes, each player can run their own individual race.

You can read about mysql here: http://www.mysql.com/
Reply
#19

It Crash When I Compile
Reply
#20

Good
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)