Weird bug...
#1

I made this Command: http://pastebin.com/fe3c86b6
The Save Callback: http://pastebin.com/f2021c80b
When I do: /addcar 560 3 3 it spawns the Car with the correct color and puts me as Driver.
The problem when It saves It Adds the New car I added in the FIRST LINE(basically Deletes the first and replaces it with the /addcar line) and only save about 85-87 Cars instead of the Already spawned 169 cars + 1 car I just spawned adding it to the file IN THE END of it
Reply
#2

what's the size of DynamicCars?
Reply
#3

pawn Код:
#define MAX_DYN_CARS      700
new DynamicCars[MAX_DYN_CARS][Cars];
I wanted to make it work for the limit of the default SAMP Car Streamer and Load only the amount of cars which are in the file.
Reply
#4

Well here's what you need to do, methinks.

OnFilterScriptInit() you need to determine how many vehicles are already in the file
so something like
pawn Код:
// new DynCars; this would go uptop

new File:file = fopen("whatever",io_read);
new tmpstr[200];
for(new i; i <MAX_DYN_CARS;i++)
{
  fread(file,tmpstr,sizeof(tmpstr));
  if(!tmpstr[0])return 1;
  else DynCars++;
}
that would determine how many vehicles are already saved.
then in your command, instead of saving it to the 'i' variable, save it to the DynCars variable, and makesure to do DynCars++ at the end of the command, and make sure it isn't going over 700 at the beginning of the command so:

pawn Код:
if(DynCars>700) return SendClientMessage(playerid,0xFF0000FF,"FAIL!");
...
// your command
...
DynCars++;
return 1;
Reply
#5

Quote:
Originally Posted by SilentHuntR
Well here's what you need to do, methinks.

OnFilterScriptInit() you need to determine how many vehicles are already in the file
so something like
pawn Код:
// new DynCars; this would go uptop

new File:file = fopen("whatever",io_read);
new tmpstr[200];
for(new i; i <MAX_DYN_CARS;i++)
{
  fread(file,tmpstr,sizeof(tmpstr));
  if(!tmpstr[0])return 1;
  else DynCars++;
}
that would determine how many vehicles are already saved.
then in your command, instead of saving it to the 'i' variable, save it to the DynCars variable, and makesure to do DynCars++ at the end of the command, and make sure it isn't going over 700 at the beginning of the command so:

pawn Код:
if(DynCars>700) return SendClientMessage(playerid,0xFF0000FF,"FAIL!");
...
// your command
...
DynCars++;
return 1;
Ok, You kinda confused me what to do where. BTW its a GM so...
Reply
#6

Are you using Norns Car System?
Reply
#7

Quote:
Originally Posted by JeNkStAX
Are you using Norns Car System?
I'm using his GameMode, Trying to modify his Car System so I can Add cars IG.
Now I tried what SilentHunteR suggested it Works now but Also Saves another 84 Cars after the New car...
And How do I write this: "None" on the DynamicCars[i][CarOwner] ? I mean I tried: DynamicCars[i][CarOwner] = "None"; and I get Errors
I want there to be a Name/Text.
Reply
#8

Bump Any 1?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)