16.08.2012, 22:37
Bom gente uso esse sistema de corrida, e possui o comando /srace que e salvar a corrida, mais sempre quando eu acabo de criar a corrida os cps.. etc, ai o meu console fecha sozinho e nгo salva..
Esse й o comando:
Esse й o comando:
pawn Код:
dcmd_srace(playerid, params[])
{
if(IsNotAdmin(playerid)) return 1;
if(BuildingRace[playerid]!=0){
if(SetedLimit[playerid] == 0) return SendClientMessage(playerid, RED, "-Aviso- {FFFFFF}Por Favor use {FF0000}/setlimit {FFFFFF}Para setaro limite de players.");
if(SetedWorld[playerid] == 0) return SendClientMessage(playerid, RED, "-Aviso- {FFFFFF}Por Favor use {FF0000}/setworld {FFFFFF}Para setar o mundo da corrida.");
if(ModeFoot[playerid] == 0) {
if(SetedCar[playerid] == 0) { return SendClientMessage(playerid, RED, "-Aviso- {FFFFFF}Por Favor use {FF0000}/setcar {FFFFFF}Para setar o veiculo da corrida."); }
}
if(ModeFoot[playerid] == 1) CarRace[playerid] = 0;
if(ModeFoot[playerid] == 1 && ActualVehicle[playerid]==0) return SendClientMessage(playerid, RED, "-Aviso- {FFFFFF}Por Favor use /saverace, Esta corrida precisa consertar carros.");
if(StartPointX[playerid] == 0) return SendClientMessage(playerid, RED, "-Aviso- {FFFFFF}Por Favor use {FF0000}/fcp {FFFFFF}Para setar o spawn da corrida");
new tmp[256], idx;
tmp = strtok(params, idx);
if(!strlen(tmp)){
SendClientMessage(playerid, RED, "-Comando Errado- {FFFFFF}USE: /srace [nome]");
return 1;
}
if(BCurrentCheckpoints[Builder(playerid)] < 5){
SendClientMessage(playerid, RED, "-Erro- {FFFFFF}Crie uma corrida com mais de 5 Checkpoints");
return 1;
}
new NameRace[64], Total[10000], Exist[512];
format(NameRace, 32, "/AppleRace/%s.ApR",tmp);
if(fexist(NameRace)){
format(Exist, sizeof(Exist), "-Aviso- {FFFFFF}Corrida \"%s\" jб existe, Mude o nome.",tmp);
SendClientMessage(playerid, RED, Exist);
return 1;
}
format(NameRace, 32, "/AppleRace/%s.ApR",tmp);
new Creator[MAX_PLAYER_NAME];
GetPlayerName(playerid, Creator, MAX_PLAYER_NAME);
new CorridaNome[64];
format(CorridaNome, 32, "%s",tmp);
INI_Open(NameRace);
INI_WriteString("Name", CorridaNome);
INI_WriteString("Creator", Creator);
INI_WriteInt("ModeFoot", ModeFoot[playerid]);
INI_WriteInt("Limit", LimitPersons[playerid]);
INI_WriteInt("World", RaceWorld[playerid]);
INI_WriteInt("Vehicle", CarRace[playerid]);
INI_WriteFloat("StartCPX", StartPointX[playerid]);
INI_WriteFloat("StartCPY", StartPointY[playerid]);
INI_WriteFloat("StartCPZ", StartPointZ[playerid]);
INI_WriteFloat("StartCPA", StartPointA[playerid]);
for(new i = 0; i < BCurrentCheckpoints[Builder(playerid)]+1;i++)
{
if(BCheckpoints[Builder(playerid)][i][0] == 0) break;
format(StringGlobal, sizeof(StringGlobal),"%f %f %f",BCheckpoints[Builder(playerid)][i][0], BCheckpoints[Builder(playerid)][i][1], BCheckpoints[Builder(playerid)][i][2]);
format(Total,sizeof(Total),"CP:%d",i);
INI_WriteString(Total, StringGlobal);
}
INI_Save();
INI_Close();
new File:f;
f = fopen("AppleRace/RaceList.ApR",io_append);
format(StringGlobal, sizeof(StringGlobal), "%s %s\n", tmp, Creator);
fwrite(f,StringGlobal);
fclose(f);
if(ModeFoot[playerid] == 1 && ActualVehicle[playerid]>=1){
new File:z;
z = fopen("/AppleRace/Cars.CApR", io_append);
for(new i = 0; i < ActualVehicle[playerid]; i++)
{
if(ActualVehicle[playerid]==0) break;
format(StringGlobal, sizeof(StringGlobal),"%d,%f,%f,%f,%f,%d,%d,%i ;\n",BCars[Builder(playerid)][i][0], BCars[Builder(playerid)][i][1], BCars[Builder(playerid)][i][2], BCars[Builder(playerid)][i][3], BCars[Builder(playerid)][i][4], BCars[Builder(playerid)][i][5], BCars[Builder(playerid)][i][6], BCars[Builder(playerid)][i][7]);
fwrite(z, StringGlobal);
}
fclose(z);
}
new Mensagem[512];
format(Mensagem,sizeof(Mensagem),"-Sucesso- {FFFFFF}Sua corrida \"%s\" Foi criada com sucesso!",tmp);
SendClientMessage(playerid, GREEN, Mensagem);
}else{
SendClientMessage(playerid, RED, "-Erro- {FFFFFF}Vocк nгo estб configurando uma corrida.");
}
return 1;
}