06.07.2011, 14:03
Hi there,
So I have one problem, when I add SpeedCam, if it is only one in file, server load it normal, but if there is 2 or more, server just say UNKNOWN COMMAND, so here is code for reading and adding speedcams
if any one know how to help me, please do that
So I have one problem, when I add SpeedCam, if it is only one in file, server load it normal, but if there is 2 or more, server just say UNKNOWN COMMAND, so here is code for reading and adding speedcams
pawn Код:
public AddSpeedCam(playerid, speed){
new Float:X, Float:Y, Float:Z, scString[128];
new File:SpeedCamsFile = fopen("speedcams.txt", io_append);
GetPlayerPos(playerid, X, Y, Z);
format(scString, sizeof(scString), "%f,%f,%f,%d\n", X, Y, Z, speed);
fwrite(SpeedCamsFile, scString);
fclose(SpeedCamsFile);
return 1;
}
public LoadSpeedCams(){
print("Loading SpeedCams...");
new String_SC[256], Split_String[5][20], SC;
if(!dini_Exists("speedcams.txt")){
return 1;
}
SC = 0;
new File:LoadSC = fopen("speedcams.txt", io_read);
while(fread(LoadSC, String_SC)){
printf("%s", String_SC);
split(String_SC, Split_String, ',');
SpeedCams[SC][scX] = floatstr(Split_String[0]);
SpeedCams[SC][scY] = floatstr(Split_String[1]);
SpeedCams[SC][scZ] = floatstr(Split_String[2]);
SpeedCams[SC][scMax_Speed] = strval(Split_String[3]);
SC++;
}
fclose(LoadSC);
return 1;
}