[HELP]License plate bug
#1

Hello i have weird problem when i set a license plate to a car in my server.
Everything is good when i set it but when i restart the server my license plate its not that i want.
[ 1 ]
[ 2 ]
When i restart the server ...
[ 3 ]
The command code is:
Код:
CMD:shopplate(playerid, params[])
{
    if(PlayerInfo[playerid][pShopTech])
	{
		new iVehType, iVehIndex, iTargetOwner, carid, orderid, plate[32];
        if(sscanf(params, "dds[32]", carid, orderid, plate))
		{
		    SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /shopplate [carid] [orderid] [plate/remove]");
		    SendClientMessageEx(playerid, COLOR_GREY, "COLORS: (black/white/blue/red/green/purple/yellow/lightblue/navy/beige/darkgreen/darkblue/darkgrey/gold/brown/darkbrown/darkred");
			SendClientMessageEx(playerid, COLOR_GREY, "/maroon/pink) USAGE: (red)Hi(white)how are you? NOTE: Each color counts for 8 characters");
			return 1;
		}

		foreach(Player, i)
		{
			iVehIndex = GetPlayerVehicle(i, carid);
			if(iVehIndex != -1)
			{
				iVehType = 1;
				iTargetOwner = i;
				break;
			}
		}
		if(iVehType == 1)
		{
		    format(plate, sizeof(plate), "%s", str_replace("(black)", "{000000}", plate));
		    format(plate, sizeof(plate), "%s", str_replace("(white)", "{FFFFFF}", plate));
		    format(plate, sizeof(plate), "%s", str_replace("(blue)", "{0000FF}", plate));
		    format(plate, sizeof(plate), "%s", str_replace("(red)", "{FF0000}", plate));
		    format(plate, sizeof(plate), "%s", str_replace("(green)", "{008000}", plate));
		    format(plate, sizeof(plate), "%s", str_replace("(purple)", "{800080}", plate));
		    format(plate, sizeof(plate), "%s", str_replace("(yellow)", "{FFFF00}", plate));
		    format(plate, sizeof(plate), "%s", str_replace("(lightblue)", "{ADD8E6}", plate));
		    format(plate, sizeof(plate), "%s", str_replace("(navy)", "{000080}", plate));
		    format(plate, sizeof(plate), "%s", str_replace("(beige)", "{F5F5DC}", plate));
		    format(plate, sizeof(plate), "%s", str_replace("(darkgreen)", "{006400}", plate));
		    format(plate, sizeof(plate), "%s", str_replace("(darkblue)", "{00008B}", plate));
		    format(plate, sizeof(plate), "%s", str_replace("(darkgrey)", "{A9A9A9}", plate));
		    format(plate, sizeof(plate), "%s", str_replace("(gold)", "{FFD700}", plate));
		    format(plate, sizeof(plate), "%s", str_replace("(brown)", "{A52A2A}", plate));
		    format(plate, sizeof(plate), "%s", str_replace("(darkbrown)", "{5C4033}", plate));
		    format(plate, sizeof(plate), "%s", str_replace("(darkred)", "{8B0000}", plate));

		    new string[128], Float:X, Float:Y, Float:Z;
		    GetVehiclePos(carid, X, Y, Z);
		    if(strcmp(plate, "remove", true) == 0)
		    {
		        PlayerVehicleInfo[iTargetOwner][iVehIndex][pvPlate] = 0;
		    }
		    else
		    {
				format(PlayerVehicleInfo[iTargetOwner][iVehIndex][pvPlate], 32, "%s", plate);
				SetVehicleToRespawn(carid);
				SetVehiclePos(carid, X, Y, Z);
			}
			new query[2048];
			SaveAccountsUpdate();
			format(query, sizeof(query), "%s `pv%dPlate` = '%s';", query, iVehIndex,plate );
			format(string, sizeof(string), "Plate set on %s (ID: %d) %s (ID: %d)", GetPlayerNameEx(iTargetOwner), iTargetOwner, GetVehicleName(carid), carid);
			SendClientMessage(playerid, COLOR_WHITE, string);
			format(string, sizeof(string), "(OrderID: %d) Plate: %s", orderid, plate);
			SendClientMessage(playerid, COLOR_WHITE, string);
			format(string, sizeof(string), "%s set %s %s (Slot %d) plate to %s (order %d)", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetOwner), GetVehicleName(carid), iVehIndex, plate, orderid);
			Log("logs/shoplog.log", string);
		}
		else
		{
		    SendClientMessageEx(playerid, COLOR_GRAD1, "This is not a player owned vehicle, you cannot give it a custom plate.");
		}
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
	}
	return 1;
}
Please help..
Reply
#2

looks like you format a query, then you don't do anything with it, db_query, db_free_result, those should be used aswell.
Reply
#3

If you saved the license plate correctly, you have maybe forgotten to apply it to a vehicle when a player connects the server. After CreateVehicle(...) when vehicles are created, you will need to use a function to apply saved string to a license plate.
Reply
#4

Press CTRL+F and search for the following:

pawn Код:
public OnVehicleSpawn(playerid)
&

pawn Код:
public OnGameModeInit()
Then paste your code here.
Reply
#5

public OnVehicleSpawn(playerid)
Wtf i tryed to search in my gamemode and i found nothing..?
On game mode int
Код:
public OnGameModeInit()
{



	SetTimer("TakeHealthDown", 25000, 1);
	print("Brahem Ghazi's Gamemode started.");
	// Default Rates
	print("Brahem Ghazi's Gamemode started.");
    new a[][] =
    {
        "Unarmed (Fist)",
        "Brass K"
    };
    #pragma unused a
    print("Brahem best of GM started.");
    //InitDatabase();
    //Audio_SetPack("default_pack", true);
    djson_GameModeInit();
	EnableStuntBonusForAll(0);
	new servergmtextstr[128];
	format(servergmtextstr, 128, "gamemodetext %s", SERVER_GM_TEXT);
	SendRconCommand(servergmtextstr); // DO NOT REMOVE THIS
	new string[42];
	new string1[MAX_PLAYER_NAME];
	ShowPlayerMarkers(PLAYER_MARKERS_MODE_STREAMED);
	DisableInteriorEnterExits();
    LoadBiz();
	InitTurfWars();
	LoadTurfWars();
	InitPaintballArenas();
	LoadPaintballArenas();
	InitEventPoints();
	LoadEventPoints();
	LoadDynamicDoors();
	LoadDynamicMapIcons();
	LoadHouses();
	LoadGates();
	LoadBoxer();
	LoadStuff();
	print("Brahem Ghazi's Gamemode ready to start.");
	LoadElevatorStuff();
	LoadServerStats();
	LoadThePay();
	LoadFamilies();
	LoadPoints();
	LoadcDealerships();
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)