SA-MP Forums Archive
Help: /mycars - 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)
+--- Thread: Help: /mycars (/showthread.php?tid=657576)



Help: /mycars - SweetCZ - 10.08.2018

Hi

I have command /mycars - but it doesn't work, because: SERVER:Unknown command

I tried to put prints and it works to number 3 (problem is format maybe)

Код:
dcmd_mycars(playerid, params[])
{
	#pragma unused params
    for(new i=0; i< MAX_VEHICLES; i++)
    {
        print("0");
        if(fexist(VehiclePath(i)))
        {
            print("1");
	        if(!strcmp(CarOwner[i], PlayerName(playerid), false))
	        {
	            print("2");
				new string[200];
    			strcat(string, "VehicleID: "COL_LIGHTBLUE"%d"COL_WHITE" | Model: "COL_LIGHTBLUE"%s"COL_WHITE" | Zamčenй: "COL_LIGHTBLUE"%s"COL_WHITE" | Benzнn: "COL_LIGHTBLUE"%dl"COL_WHITE" | Najeto: "COL_LIGHTBLUE"%dkm", sizeof(string));
                print("3");
				format(string, sizeof(string), string, i, SeznamAut[CarModel[i] - 400], AnoNe[CarLock[i]], CarFuel[i], CarNajeto[i]);
				SCM(playerid, COLOR_WHITE, string);
				print("4");
		    }
	    }
	}
	return 1;
}
Thank you for your help.


Re: Help: /mycars - NeXTGoD - 10.08.2018

The problem is that you used strcat before format, you should use format and then strcat


Re: Help: /mycars - SweetCZ - 12.08.2018

Quote:
Originally Posted by NeXTGoD
Посмотреть сообщение
The problem is that you used strcat before format, you should use format and then strcat
It's not really problem, it doesn't work still, but thank you.


Re: Help: /mycars - GangstaSunny. - 12.08.2018

Put "new string" out oft the loop.


Re: Help: /mycars - CodeStyle175 - 12.08.2018

very badly written gamemode, there is no point for developing this forward. you just dont use ini system for vehicles. and dcmd shit


Re: Help: /mycars - SweetCZ - 14.08.2018

Quote:
Originally Posted by CodeStyle175
Посмотреть сообщение
very badly written gamemode, there is no point for developing this forward. you just dont use ini system for vehicles. and dcmd shit
Thank you for your help!!! I have never didn't see guy who can rate gamemode where he saw 20 lines of code can you write me why shouldn't I use ini and dcmd ?


Re: Help: /mycars - NeXTGoD - 14.08.2018

Код:
new string[500],string2[256];
format(string2, sizeof string2,  "VehicleID: "COL_LIGHTBLUE"%d"COL_WHITE" | Model: "COL_LIGHTBLUE"%s"COL_WHITE" | Zamčenй: "COL_LIGHTBLUE"%s"COL_WHITE" | Benzнn: "COL_LIGHTBLUE"%dl"COL_WHITE" | Najeto: "COL_LIGHTBLUE"%dkm", i, SeznamAut[CarModel[i] - 400], AnoNe[CarLock[i]], CarFuel[i], CarNajeto[i]);
strcat(string, , string2);
SCM(playerid, COLOR_WHITE, string);