[HELP] License Plate
#1

I have two problems... After i have typed "/caroptions" then i die after the dialog comes to my screen =/

and how can i change "Larsey123" to inputtext


pawn Код:
#include <a_samp>

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/caroptions", true))
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFF0000FF,"You must be in a vehicle.");
        {
            ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Car Options", "License Plate", "Select", "Cancel");
            return 1;
        }
    }
    return 0;
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1)
    {
        if(response)
        {
            if(listitem == 0) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Linence Plate", "Enter your license nuber (MAX: 32 characters)", "Update", "Cancel");
        }
    }
   
    else if(dialogid == 2)
    {
        if(response)
        {
            for(new v = 0; v < MAX_PLAYERS; v ++)
            {
                SetVehicleNumberPlate(v, "Larey123");
                SetVehicleToRespawn(v);
            }
            return 1;
        }
    }
    return 0;
}
Reply
#2

Try this, it is not tested.

pawn Код:
#include <a_samp>

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/caroptions", true))
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFF0000FF,"You must be in a vehicle.");
       
            ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Car Options", "License Plate", "Select", "Cancel");
            return 1;
     
    }
    return 0;
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1)
    {
        if(response)
        {
            if(listitem == 0) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Linence Plate", "Enter your license nuber (MAX: 32 characters)", "Update", "Cancel");
        }
    }
   
    else if(dialogid == 2)
    {
        if(response)
        {
            for(new v = 0; v < MAX_PLAYERS; v ++)
            {
                SetVehicleNumberPlate(v,inputtext);
                SetVehicleToRespawn(v);
            }
            return 1;
        }
    }
    return 0;
}
Reply
#3

Thanks... but why is he dying?

1: /caroptions
2: Dialog "Car Options" comes up
3: Click on "License Plate"
4: Enter My License number
5: Then i click "Update"
6: Then i die =/
Reply
#4

try TogglePlayerControllable(playerid, 0);
when executing the command
and TogglePlayerControllable(playerid, 1);
when finishing with the Dialog...
when you are freezed you can't lose health, which could help maybe...
Reply
#5

THANKS
Reply
#6

Quote:
Originally Posted by Larsey123IsMe
Посмотреть сообщение
Thanks... but why is he dying?

1: /caroptions
2: Dialog "Car Options" comes up
3: Click on "License Plate"
4: Enter My License number
5: Then i click "Update"
6: Then i die =/
I am probably wrong, but try to remove 'for loop' and test it, i have somehow feeling that it is responsible for killing player.

EDIT:NVM this, as it is solved.
Reply
#7

Another question: How to respawn the car where i am...

Example:

1.) I find a car on the road
2.) Drive 1 mile or W/E
3.) Open the "/caroptions" and change numbers..
4.) The car respawn where i am. not where i found it..


but it is like this niw:

1.) I find a car on the road
2.) Drive 1 mile or W/E
3.) Open the "/caroptions" and change numbers..
4.) then the car respawn there i found it
Reply
#8

Use:

pawn Код:
#include <a_samp>

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/caroptions", true))
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFF0000FF,"You must be in a vehicle.");
       
            ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Car Options", "License Plate", "Select", "Cancel");
            return 1;
     
    }
    return 0;
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1)
    {
        if(response)
        {
            if(listitem == 0) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Linence Plate", "Enter your license nuber (MAX: 32 characters)", "Update", "Cancel");
        }
    }
   
    else if(dialogid == 2)
    {
        if(response)
        {
            for(new v = 0; v < MAX_PLAYERS; v ++)
            {
                New Float:X, Float:y, Float:z, Floatt:A;
                GetPlayerPos(playerid, X, Y, Z);
                GetPlayerFacingAngle(playerid, Angle);
                SetVehicleNumberPlate(v,inputtext);
                SetVehicleToRespawn(v);
                SetVehiclePos(v, X, Y, Z);
                SetVehicleZAngle(v, A);
                PutPlayerInVehicle(playerid, v, 0)

            }
            return 1;
        }
    }
    return 0;
}
Reply
#9

That fucked my game xD... maybe my fault?

Your code had some errors/warnings.. so i edited it like this(bit it fucks my game =/):
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1)
    {
        if(response)
        {
            if(listitem == 0) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Linence Plate", "Enter your license nuber (MAX: 32 characters)", "Update", "Cancel");
        }
    }

    else if(dialogid == 2)
    {
        if(response)
        {
            for(new v = 0; v < MAX_PLAYERS; v ++)
            {
                new Float:X, Float:Y, Float:Z, Float:A;
                GetPlayerPos(playerid, X, Y, Z);
                GetPlayerFacingAngle(playerid, A);
                SetVehicleNumberPlate(v,inputtext);
                SetVehicleToRespawn(v);
                SetVehiclePos(v, X, Y, Z);
                SetVehicleZAngle(v, A);
                PutPlayerInVehicle(playerid, v, 0);
            }
            return 1;
        }
    }
    return 0;
}
Reply
#10

Bump.



Is it 48 hours between evry bump? If yes, then sorry for this bump, i really need this
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)