SA-MP Forums Archive
#defining 1000 houses - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: #defining 1000 houses (/showthread.php?tid=262150)



#defining 1000 houses (not manually) - jamesbond007 - 16.06.2011

i really need help now.. its not easy but i need to #define 1000 houses

and i dont want to write it all

so is there any way to use loop so i can define or is there other way (tools) that i can type it all out ?

i tried making something like

Код:
new housestr[128];
for(new i=0;i<1000;i++)
{
	format(housestr,sizeof(housestr),"#define CP_%i %i",i++, i);
}
but obviously doesnt work so can any one of you "pro" scripters help me ? =)

help is really appriciated! thanks in advance


Re: #defining 1000 houses - Donya - 16.06.2011

pawn Код:
#define Houses 1000
new houses = Houses;
for(new i = 0; i < houses; i++)
{
    format(housestr,sizeof(housestr),"#define CP_%i %i",i++, i);
}
is that what u mean?


Re : #defining 1000 houses - Shidony - 16.06.2011

pawn Код:
#define MAX_HOUSES 1000
for(new i=0;i<MAX_HOUSES;i++)
{
    format(housestr,sizeof(housestr),"#define CP_%i %i",i++, i);
}
Try that


Re: #defining 1000 houses - jamesbond007 - 16.06.2011

i dont think so man... this is what im trying to do :

Код:
#define CP_1 0
#define CP_2 1
#define CP_3 2
#define CP_4 3
#define CP_5 4
#define CP_6 5
#define CP_7 6
#define CP_8 7
like this but to 1000... so u understand my problem if i type it all out it will take me more then an hour

sry i cant explain it better :/


Re: #defining 1000 houses - Cyanide - 16.06.2011

It's not possible. You cannot redefine definitions.


Re : #defining 1000 houses - Shidony - 16.06.2011

And you cannot put more than 1 cp on your map


Re: #defining 1000 houses - jamesbond007 - 16.06.2011

not redefine... i want to DEFINE without typing define 1000 times !!!! All im asking: Is It Possible?? if yes then how??

@Shidony checkpoint streamer >.>

come on guys doesnt anyone have a solution for this?


Re: #defining 1000 houses - Cyanide - 16.06.2011

Quote:
Originally Posted by jamesbond007
Посмотреть сообщение
not redefine... i want to DEFINE without typing define 1000 times !!!! All im asking: Is It Possible?? if yes then how??
It still doesn't matter, you cannot redefine / define something once the AMX is compiled.


Re: #defining 1000 houses - Donya - 16.06.2011

pawn Код:
#define MAX_HOUSES 1000
for(new i = 0; i != MAX_HOUSES; i++)
{
    printf("#define CP_%i %i", i + 1, i);
}
lol i dont understand why u would even use something like this..

just use

pawn Код:
New Housecp[MAX_HOUSES];
Housecp[houseid] = CreateDynamicCP(...);



Re: #defining 1000 houses - jamesbond007 - 16.06.2011

@donya why printf? i want to compile it.. so i dont have to type define 1000 times .. it doesnt have to do anything with the script its me just being lazy... lol