When I click on the "Ready"
#1

Код:
#include <a_samp>
#define COLOR_GRAY 0xBFC0C2FF
#define PLATE 1234

public OnFilterScriptInit()
{
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

public OnPlayerConnect(playerid)
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/plate", cmdtext, true, 10) == 0)
	{
		if(IsPlayerInAnyVehicle(playerid))
		{
			ShowPlayerDialog(playerid, PLATE, DIALOG_STYLE_INPUT, "Plate", "Write the number of vehicle below:\n\n(minimum: 1 symbol | maximum: 8 symbol)", "Ready", "Cancel");
		}
		else
		{
			SendClientMessage(playerid, COLOR_GRAY, "You are not logged in car!");
		}
		return 1;
	}
	return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == PLATE)
	{
	    new string[128], Float:X, Float:Y, Float:Z, Float:angle;
		if(strlen(inputtext) < 1 || strlen(inputtext) > 8)
		return SendClientMessage(playerid, COLOR_ERROR, "Invalid length of text!");
		else
		{
		    format(string, sizeof(string), "The text of your registration number is changed to '%s'.", inputtext);
		    SendClientMessage(playerid, COLOR_INFORMATION, string);
		    GetPlayerPos(playerid, X, Y, Z);
		    GetPlayerFacingAngle(playerid, angle);
		    SetVehicleNumberPlate(GetPlayerVehicleID(playerid), inputtext);
		    SetVehicleToRespawn(GetPlayerVehicleID(playerid));
			GetPlayerPos(playerid, X, Y, Z);
			SetVehiclePos(GetPlayerVehicleID(playerid), X, Y, Z);
			SetVehicleZAngle(GetPlayerVehicleID(playerid), angle);
			PutPlayerInVehicle(playerid, GetPlayerVehicleID(playerid), 0);
			SetVehiclePos(GetPlayerVehicleID(playerid), X, Y, Z+2);
		}
	}
	return 1;
}
When I click on the "Ready" I do not write anything that is not link with each other
Reply
#2

Sorry, but I don't understand what do you mean.
Reply
#3

I mean no dialogue PLATE function, which must be done. When clicking "Ready" he put the number you have brought
Reply
#4

You forgot the response.

Try this code:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == PLATE)
    {
        if(response)
        {
            new string[128], Float:X, Float:Y, Float:Z, Float:angle;
            if(strlen(inputtext) < 1 || strlen(inputtext) > 8)
            return SendClientMessage(playerid, COLOR_ERROR, "Invalid length of text!");
            else
            {
                format(string, sizeof(string), "The text of your registration number is changed to '%s'.", inputtext);
                SendClientMessage(playerid, COLOR_INFORMATION, string);
                GetPlayerPos(playerid, X, Y, Z);
                GetPlayerFacingAngle(playerid, angle);
                SetVehicleNumberPlate(GetPlayerVehicleID(playerid), inputtext);
                SetVehicleToRespawn(GetPlayerVehicleID(playerid));
                GetPlayerPos(playerid, X, Y, Z);
                SetVehiclePos(GetPlayerVehicleID(playerid), X, Y, Z);
                SetVehicleZAngle(GetPlayerVehicleID(playerid), angle);
                PutPlayerInVehicle(playerid, GetPlayerVehicleID(playerid), 0);
                SetVehiclePos(GetPlayerVehicleID(playerid), X, Y, Z+2);
            }
        }
    }
    return 1;
}
Reply
#5

still does not work
Reply
#6

Quote:
Originally Posted by Join7
Посмотреть сообщение
still does not work
You read the wiki?
https://sampwiki.blast.hk/wiki/SetVehicleNumberPlate

Look at the note

Quote:

Note: The vehicle must be respawned or restreamed for the changes to take effect.

Reply
#7

So what do you mean if you can edit the code in the outpost
Reply
#8

It's obvious that you are unwilling to try doing something on your own. You would rather someone give you working code, compared to you trying to follow their instructions or reading something from the SA-MP Wiki. That isn't going to get you very far. If you think coding is a simple task, you're wrong.
Reply
#9

I know, but in vain, trying to ...
It makes no sense so better ...

ON Topic: general command /plate did not work as to not try it today all day and try without success
Reply
#10

Quote:
Originally Posted by Join7
Посмотреть сообщение
I know, but in vain, trying to ...
It makes no sense so better ...

ON Topic: general command /plate did not work as to not try it today all day and try without success
Im going to help you on your way.

When you press Ready in your dialog, give a specific vehicleid to the vehicle you are in.
Destroy the vehicle with that specific vehicleid and let it respawn again.
Then your license plate should have been changed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)