hey i want something

Started by Spidey, Aug 28, 2015, 10:54 AM

Previous topic - Next topic

Spidey

i want car command can you plzz post here
gta vc and san are my favourite games

Spidey

and want tell you all something seby our friend is gone
gta vc and san are my favourite games

KAKAN

oh no

Xmair

#3
He left.
On topic :- Happy scripting.
Use this code.

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

KAKAN

Wrong, where are the RGB in....
oh no

Spidey

i dont know saw it in his signature
gta vc and san are my favourite games

Spidey

it is wrong kakan can you plzzz post real snipet here
gta vc and san are my favourite games

SAzEe21

Use this one.... Hope, it will work fine...
else if ( cmd == "car" )
{
     local plr = GetPlayer( text );
if ( !text ) MessagePlayer( "[Syntax] - /" + cmd + " <Nick/ID>.", player );
else{
    if ( !plr ) MessagePlayer( "[Error] - Invalid Nick/ID", player );
else if ( !plr.IsSpawned ) MessagePlayer( "[Error] - This player hasn't spawned.", player );
else
{
local veh = plr.Vehicle;
if ( veh )
{
local vid = veh.ID, hp = veh.Health.tointeger() /10;
MessagePlayer( plr + " is driving a " + GetVehicleNameFromModel( veh.Model ) + " (ID: " + vid + ") (Health: " + hp + "%)", player );
local q = QuerySQL( db, "SELECT * FROM Vehicles WHERE ID='" + veh.ID + "'" );
            MessagePlayer( "Vehicle:[ " + GetVehicleNameFromModel( veh.Model ) + " ] Cost:[ " + GetSQLColumnData( q, 1 ) + " ]", player );
            MessagePlayer( "ID:[ " + veh.ID + " ] Owner:[ " + GetSQLColumnData( q, 2 ) + " ] Share:[ " + GetSQLColumnData( q, 3 ) + " ]", player );
}
else MessagePlayer( plr + " is currently on foot.", player );
}
}
}

FinchDon

Will not work if he don't have queries Easy One

Use GetVehicleNameFromModel( vehicle )
For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )

KAKAN

Here is a simple car cmd:-
else if ( cmd == "car" )
{
if(!text)MessagePlayer("[Syntax]: /" + cmd + " <player ID/Name>.",player );
else
{
local plr = GetPlayer(text)
if(!plr) MessagePlayer("Error: Unknown Player.",player);
else if(!plr.IsSpawned)MessagePlayer("Error: The requested player has not spawned yet.",player);
else if(!plr.Vehicle)MessagePlayer(">> " + plr.Name + " is currently on foot.",player);
else
{
MessagePlayer(">> " + plr.Name + " is driving a " + plr.Vehicle.Model + "." );
}
}
}

Here is the GetPlayer function(add this if u don't have it)
function GetPlayer( plr )
{
    if ( plr )
    {
        if ( IsNum( plr ) )
        {
            plr = FindPlayer( plr.tointeger() );
            if ( plr ) return plr;
            else return null;
        }
        else
        {     
            plr = FindPlayer( plr );
            if ( plr ) return plr;
            else return null;
        }
    }
    else return null;
}
oh no

Xmair

#10
Quote from: KAKAN on Aug 28, 2015, 02:31 PMHere is a simple car cmd:-
else if ( cmd == "car" )
{
if(!text)MessagePlayer("[Syntax]: /" + cmd + " <player ID/Name>.",player );
else
{
local plr = FindPlayer(text)
if(!plr) MessagePlayer("Error: Unknown Player.",player);
else if(!plr.IsSpawned)MessagePlayer("Error: The requested player has not spawned yet.",player);
else if(!plr.Vehicle)MessagePlayer(">> " + plr.Name + " is currently on foot.",player);
else
{
MessagePlayer(">> " + plr.Name + " is driving a " + plr.Vehicle.Model + "." );
}
}
}

Here is the GetPlayer function(add this if u don't have it)
function GetPlayer( plr )
{
    if ( plr )
    {
        if ( IsNum( plr ) )
        {
            plr = FindPlayer( plr.tointeger() );
            if ( plr ) return plr;
            else return null;
        }
        else
        {     
            plr = FindPlayer( plr );
            if ( plr ) return plr;
            else return null;
        }
    }
    else return null;
}
@KAKAN This code needs another function, Better use my code.
else if ( cmd == "car" )
{     
if ( !text ) MessagePlayer( "Syntax, /" + cmd + " <Nick/ID>.", player ); /*Checks if the player has wrote nothing just /car.*/
else{ /*If the check of text is passed than we will go here.*/
local plr = FindPlayer( text ); /*Finds the player.*/
    if ( !plr ) MessagePlayer( "Error: Invalid player.", player ); /*Checks if the player is online.*/
else if ( !plr.IsSpawned ) MessagePlayer( "Error: This player hasn't spawned.", player ); /* Checks if the player is spawned.*/
else /*If it passed more checks, This will come.*/
{
local veh = plr.Vehicle; /*This just smaller plr.Vehicle to veh.*/
if ( veh ) /*Checks if the player is in a vehicle.*/
{
local vid = veh.ID, hp = veh.Health.tointeger() / 10; /*This will divide the vehicle's hp to 10% because the vehicle's hp is around 1000 when it's 100%.*/
MessagePlayer( plr.Name + " is driving a " + GetVehicleNameFromModel(veh.Model) + " (ID: " + vid + ") (Health: " + hp + "%)", player ); /*Finally sends a message about his car, ID and the vehicle's HP.*/
}
else MessagePlayer( plr + " is currently on foot.", player ); /*If not in a vehicle this will show up.*/
}
}
}
This code will even make him learn something.

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

KAKAN

@Xmair What else function does it needs?
oh no

Xmair

@KAKAN I said that your code needs a function which is getplayer, use my command, it won't need any function.

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

KAKAN

@Xmair I have provided the getplayer function, can't u see it?
oh no

Xmair

I can see it, I have eyes. You can't understand what I want to say. My function will not need GetPlayer and your will need it. Anyway it's just a small thing, Stop quarelling.

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD