25.02.2010, 03:36
[FS] KRace
Info: Well, this is a race script. I made it a little while ago and decided to release it =]. It is a bit buggy so please post bugs so it can be fixed. Scripting: It's a pretty shoddy script but it works :P. It comes with a race I made called around LS. To add checkpoints you must use this format:
pawn Код:
CreateRace(RaceName[], RaceTimeout/*Will fail a player if not finished in this time (Time in Seconds)*/, vehicle = -1/*Required vehicle to start the race! (Optional)*/)
pawn Код:
AddRaceCheckpoint(RaceName[], Float:x, Float:y, Float:z)
pawn Код:
#include <a_samp>
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(AddRaceCP, 9, cmdtext);
return 0;
}
dcmd_AddRaceCP(playerid, params[])
{
new string[120];
if(!strlen(params)) return SendClientMessage(playerid, 0x00D300AA, "/AddRaceCP [RaceName]");
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
format(string, sizeof(string), "AddRaceCheckpoint(\"%s\", %f, %f, %f);\r\n", params, X, Y, Z);
new File:Check = fopen("RaceCPS.txt", io_append);
fwrite(Check, string);
fclose(Check);
return 1;
}
pawn Код:
dcmd_Startrace(playerid, params[])
{
if(!strval(params)) return //Player didn't type anything
if(/*Admin varaible here*/ == 0) return //Admin level not high enough
if(StartRace(params) == 0) return //The race name wasn't valid or there is currently a race running
if(StartRace(params) == 1) return //The race was started!
return 1;
}
Download:
PWN + AMX
Pastebin