Locked car.
#1

Hi all. I want to ask. I locked the car, but how to make, that thing, owner can get in car?

I use these function to lock car:

Код:
new vehicleid = GetPlayerVehicleID( playerid );
GetVehicleParamsEx( vehicleid,engine,lights,alarm,doors,bonnet,boot,objective );
SetVehicleParamsEx( vehicleid,engine,lights,alarm,false,bonnet,boot,objective );
Reply
#2

You will have to make a whole system about Car ownership.
Reply
#3

What's bad in this command?
Код:
enum PlayerDB
{
owner_name[ MAX_PLAYER_NAME ],
bool:Locked
}

new PlayerData[ MAX_PLAYERS ][ PlayerDB ];
Код:
COMMAND:lock(playerid,params[])
{
if(!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage( playerid, COLOR_RED,"* You must be in vehicle!");
return 1;
}
if( CreatedCar[ playerid ] ==-1)
{
SendClientMessage( playerid, COLOR_RED,"You just can lock car who you self have created with - {FF9900}/car");
return 1;
}
new vehicleid = CreatedCar[ playerid ];
if( PlayerData[ vehicleid ][ Locked ] == true )
{
SendClientMessage( playerid, COLOR_RED,"Vehicle is already locked!");
return 1;
}
PlayerData[ vehicleid ][ Locked] = true;
SendClientMessage( playerid, COLOR_GREEN,"Vehicle was sucefull locked.!");
GetPlayerName( playerid,PlayerData[ vehicleid ][ owner_name ],MAX_PLAYER_NAME);
PlayerPlaySound(playerid, 1147, 0.0, 0.0, 0.0);
return 1;
}
When i type: /lock

Server says: this command do not exist.

But if i not in car, i get that message: "You must be in vehicle".

I think this code is bad, but i don't understand what here is bad:

Код:
PlayerData[ vehicleid ][ Locked] = true;
SendClientMessage( playerid, COLOR_GREEN,"Vehicle was sucefull locked.!");
GetPlayerName( playerid,PlayerData[ vehicleid ][ owner_name ],MAX_PLAYER_NAME);
PlayerPlaySound(playerid, 1147, 0.0, 0.0, 0.0);
Here is my /car command:

Код:
COMMAND:car( playerid, params[] )
{
new carID[30],Float:X,Float:Y,Float:Z,Float:A;
if( sscanf( params, "s[30]", carID ) )
return SendClientMessage( playerid, COLOR_ORANGE, "Usage: /car [Model/Name]");
new Car;
if( !IsNumeric(carID)) Car = GetVehicleModelIDFromName(carID);
if( IsNumeric(carID)) Car = strval(carID);
if( Car < 400 || Car > 611) return SendClientMessage( playerid, COLOR_ORANGE, "Usage: /car [Model/Name (400-611)]" );
GetPlayerPos( playerid, X, Y, Z );
GetPlayerFacingAngle(playerid, A);
if( CreatedCar[ playerid ] !=-1)
{
DestroyVehicle( CreatedCar[ playerid ] );
}
CreatedCar[ playerid ] = CreateVehicle( Car, X+3, Y, Z, A, -1, -1, -1 );
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(CreatedCar[ playerid ],engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(CreatedCar[ playerid ],1,lights,alarm,doors,bonnet,boot,objective);
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)