new CRaceName[128];
COMMAND:loadrace(playerid, params[])
{
new file_name[128], str[256];
if(RaceAdmin == 1 && GetPVarInt(playerid, "admin_level") < 2)
return SendClientMessage(playerid, red, "Error: You are not authorized to use this command.");
Racemode = 0; Racelaps = 1;
if(sscanf(params, "s[128]", file_name))
return SendClientMessage(playerid, yaris, "Usage: /loadrace [race name]");
if(LoadRace(file_name) == 0)
return SendClientMessage(playerid, red ,"- Race - Race file couldn't find.");
LoadRace(file_name);
format(CRaceName, sizeof(CRaceName), "%s", file_name);
format(str, sizeof(str), "- Race - Race %s is loaded.", CRaceName);
SendClientMessage(playerid, yaris, str);
}
public LoadRace(tmp[])
{
new i;
format(raceName, sizeof(raceName), "%s.yr", tmp);
LCurrentCheckpoint = -1;
new File:raceFile = fopen(raceName, io_read);
fread(raceFile, tmp, 64);
i = 0;
while(fread(raceFile, tmp, 64, false))
{
LCurrentCheckpoint++;
i = 0;
RaceCheckpoints[LCurrentCheckpoint][0] = floatstr(strtok(tmp, i));
RaceCheckpoints[LCurrentCheckpoint][1] = floatstr(strtok(tmp, i));
RaceCheckpoints[LCurrentCheckpoint][2] = floatstr(strtok(tmp, i));
}
fclose(raceFile);
return 1;
}
COMMAND:loadrace(playerid, params[]) { new file_name[128], str[256]; if(RaceAdmin == 1 && GetPVarInt(playerid, "admin_level") < 2) return SendClientMessage(playerid, red, "Error: You are not authorized to use this command."); Racemode = 0; Racelaps = 1; if(sscanf(params, "s[128]", file_name)) return SendClientMessage(playerid, yaris, "Usage: /loadrace [race name]"); if(LoadRace(file_name) == 0) return SendClientMessage(playerid, red ,"- Race - Race file couldn't find."); format(CRaceName, sizeof(CRaceName), "%s", file_name); format(str, sizeof(str), "- Race - Race %s is loaded.", CRaceName); SendClientMessage(playerid, yaris, str); LoadRace(file_name); } |
sscanf(tmp, "s", CRaceName);