/v plate not working
#1

Hi! Can you help me with a code?

Код:
	        if(strcmp(x_nr, "plate", true) == 0)
	        {
				if(PlayerInfo[playerid][pPcarkey] == 999)
				{
					SendClientMessage(playerid, COLOR_GREY,"   You don't have a vehicle to respray.");
					return 1;
				}
				if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey] || PlayerInfo[playerid][pPcarkey2])
				{
					new Float:x,Float:y,Float:z,Float:ang;
					GetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
					GetVehicleZAngle(GetPlayerVehicleID(playerid),ang);
					if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_RED, "Nu esti intr-un vehicul!");
					new str[1028];
					format(str, 1024, "{00CC66}Scrie in casuta numarul de inmatriculare dorit!\n\n");
					format(str, 1024, "{AA3333}ATENTIE!\n");
					format(str, 1024, "{00CC66}Fara numere gen {33AA33}Maria, Cezar, Vlad, etc\n\n");
					ShowPlayerDialog(playerid,DIALOG_PLATE,DIALOG_STYLE_INPUT,"{EE7777}Plate Car", str,"Yes","Cancel");
					return 1;
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "  Nu esti in masina ta personala!");
					return 1;
				}
				for(new h = carsonserver; h < sizeof(CarInfo); h++)
				{
					format(TextCar, sizeof(TextCar), "• %s •", CarInfo[h][cLicense]);
					TextUpCar[h] = Create3DTextLabel(TextCar, 0xAA3333AA , 0.0, 0.0, 0.0, 25, 0, 1);
					Attach3DTextLabelToVehicle(TextUpCar[h], h, 0.0, 0.0, 0.1);
				}
			}
I can compile with no errors, but it's not working.
Reply
#2

how is it not working?
Reply
#3

I type "/v plate" but it's not working. I can not see any dialog.
Reply
#4

looks like and out of bounds error since the code is not running try adding print statement threw everything so that way you know where things go wrong

example
pawn Код:
if(strcmp(x_nr, "plate", true) == 0)
            {
                                print("pass1");//remove
                if(PlayerInfo[playerid][pPcarkey] == 999)
                {
                                        print("pass2a");//remove
                    SendClientMessage(playerid, COLOR_GREY,"   You don't have a vehicle to respray.");
                    return 1;
                }
                if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey] || PlayerInfo[playerid][pPcarkey2])
                {
                                        print("pass2b");//remove
                    new Float:x,Float:y,Float:z,Float:ang;
                                        print("pass3b");//remove
                    GetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
                                        print("pass4b");//remove
                    GetVehicleZAngle(GetPlayerVehicleID(playerid),ang);
                                        print("pass5b");//remove
                    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_RED, "Nu esti intr-un vehicul!");
                                        print("pass6b");//remove
                    new str[1028];
                                        print("pass6b");//remove
                    format(str, 1024, "{00CC66}Scrie in casuta numarul de inmatriculare dorit!\n\n");
                                        print("pass7b");//remove
                    format(str, 1024, "{AA3333}ATENTIE!\n");
                                        print("pass8b");//remove
                    format(str, 1024, "{00CC66}Fara numere gen {33AA33}Maria, Cezar, Vlad, etc\n\n");
                                        print("pass9b");//remove
                    ShowPlayerDialog(playerid,DIALOG_PLATE,DIALOG_STYLE_INPUT,"{EE7777}Plate Car", str,"Yes","Cancel");
                                        print("pass10b");//remove
                    return 1;
                }
                else
                {
                                        print("pass2c");//remove
                    SendClientMessage(playerid, COLOR_GREY, "  Nu esti in masina ta personala!");
                    return 1;
                }
                                print("pass11");//remove
                for(new h = carsonserver; h < sizeof(CarInfo); h++)
                {
                                        printf("pass12 - %i",h);//remove
                    format(TextCar, sizeof(TextCar), "{EE1111}Proprietar: {0099FF}• %s •", CarInfo[h][cLicense]);
                                        printf("pass13 - %i,h");//remove
                    TextUpCar[h] = Create3DTextLabel(TextCar, 0x33AAFFFF , 0.0, 0.0, 0.0, 25, 0, 1);
                                        printf("pass14 - %i",h);//remove
                    Attach3DTextLabelToVehicle(TextUpCar[h], h, 0.0, 0.0, 0.1);
                }
            }
Reply
#5

I've tried what you said, but I get unreachable code

To be more clear, this code works:
Код:
	        if(strcmp(x_nr, "plate", true) == 0)
	        {
				if(PlayerInfo[playerid][pPcarkey] == 999)
				{
					SendClientMessage(playerid, COLOR_GREY,"   You don't have a vehicle to respray.");
					return 1;
				}
				if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey] || PlayerInfo[playerid][pPcarkey2])
				{
					new Float:x,Float:y,Float:z,Float:ang;
					GetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
					GetVehicleZAngle(GetPlayerVehicleID(playerid),ang);
					if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_RED, "Nu esti intr-un vehicul!");
					new str[1028];
					format(str, 1024, "{00CC66}Scrie in casuta numarul de inmatriculare dorit!\n\n");
					format(str, 1024, "{AA3333}ATENTIE!\n");
					format(str, 1024, "{00CC66}Fara numere gen {33AA33}Maria, Cezar, Vlad, etc\n\n");
					ShowPlayerDialog(playerid,DIALOG_PLATE,DIALOG_STYLE_INPUT,"{EE7777}Plate Car", str,"Yes","Cancel");
					return 1;
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "  Nu esti in masina ta personala!");
					return 1;
				}
And after that I get the code unreachable. This is the code which seems to be unreachable:

Код:
                for(new h = carsonserver; h < sizeof(CarInfo); h++)
                {
                    format(TextCar, sizeof(TextCar), "• %s •", CarInfo[h][cLicense]);
                    TextUpCar[h] = Create3DTextLabel(TextCar, 0xAA3333AA , 0.0, 0.0, 0.0, 25, 0, 1);
                    Attach3DTextLabelToVehicle(TextUpCar[h], h, 0.0, 0.0, 0.1);
                }
            return 1;
            }
I want to show the number plate of vehicle, but it's not showing.
Reply
#6

What is the varaible CarInfo? can you do a print of carsonserver and carinfo before the loop also try printing something after the loop to see if it stops during the loop?
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)