SA-MP Forums Archive
How to make private vehicle with password and dialog? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to make private vehicle with password and dialog? (/showthread.php?tid=267358)



How to make private vehicle with password and dialog? - Aizen - 08.07.2011

Well can someone help me ,how to make private vehicle with password and dialog?we fill the password in the dialog


Re: How to make private vehicle with password and dialog? - Basicz - 08.07.2011

pawn Код:
new
    passwordedVeh,
    vehPassword[ 64 ] = "omgwtfbbq"
;

public OnGameModeInit( )
{
    passwordedVeh = AddStaticVehicle( 411, 0.0, 0.0, 0.0, 0.0, -1, -1 );

    return 1;
}

public OnPlayerEnterVehicle( playerid, vehicleid )
{
    if ( vehicleid == passwordedVeh )
    {
        ShowPlayerDialog( playerid, 777, DIALOG_STYLE_INPUT, "Error", "This vehicle is passworded, enter the password!", "Use Vehicle", "Exit" );

        TogglePlayerControllable( playerid, false );
    }

    return 1;
}

public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
{
    if ( dialogid == 777 )
    {
        if ( !strcmp( inputtext, vehPassword, false ) ) {
            TogglePlayerControllable( playerid, true );
            // success! u have entered the correct password
        }
        else {
            RemovePlayerFromVehicle( playerid );
            TogglePlayerControllable( playerid, true );
            // ERROR: u've entered a wrong password, kthxbai.
        }
    }

    return 1;
}
Something like that?


Re: How to make private vehicle with password and dialog? - Aizen - 08.07.2011

Yeah thanks sir,but i got 1 error
Код:
D:\Test server\filterscripts\Valo_Car.pwn(238) : error 017: undefined symbol "vehpassword"



Re: How to make private vehicle with password and dialog? - Basicz - 08.07.2011

It works fine like a charm for me, maybe there's a problem with your includes.

Offtopic: Iya ane Indonesia gan


Re: How to make private vehicle with password and dialog? - Aizen - 08.07.2011

Eh sorry i make a mistake this is an error

Код:
D:\Test server\filterscripts\Valo_Car.pwn(238) : error 017: undefined symbol "vehpassword"



Re: How to make private vehicle with password and dialog? - Basicz - 08.07.2011

vehpassword is CaSe SeNsItIvE

Change vehpassword

to

vehPassword


Re: How to make private vehicle with password and dialog? - Aizen - 10.07.2011

Well that code is compile,but when i enter the password i'm freeze.we must change it to OnPlayerStateChange?


Re: How to make private vehicle with password and dialog? - Jeffry - 10.07.2011

pawn Код:
public OnStateChange( playerid, newstate, oldstate )
{
    if ( newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == passwordedVeh )
    {
        ShowPlayerDialog( playerid, 777, DIALOG_STYLE_INPUT, "Error", "This vehicle is passworded, enter the password!", "Use Vehicle", "Exit" );
        TogglePlayerControllable( playerid, false );
    }

    return 1;
}
Should work then.