SA-MP Forums Archive
Little Help! - 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: Little Help! (/showthread.php?tid=243083)



Little Help! - Davz*|*Criss - 21.03.2011

Hey Guys!

Can anyone tell me how do i make an /Car (VehID) (CC1) (CC2) Command??

And i need an cmd to disable and enable chat.

Thanks.



Re: Little Help! - PinkFloydLover - 21.03.2011

Use dcmd and sscanf.

The disabling chat is easy.
create a variable:
Код:
new ChatDisabled = 0;
Then create a command, inside that command assign the ChatDisabled var to 1:
pawn Код:
dcmd_disablechat(playerid,params[])
{
    if(ChatDisabled == 0)
    {
        ChatDisabled = 1;
    }
    else
    {
        ChatDisabled = 0;    
    }
    return 1;
}
then under OnPlayerText put:
pawn Код:
if(ChatDisabled == 1) return 0;
That's a simple command for turning off and on chat.


Re: Little Help! - antonio112 - 21.03.2011

Here's the /car [Model] [CC1] [CC2] command in ZCMD + sscanf2 - Credits to Zeex and ****** for those.
pawn Код:
CMD:car( playerid, params[] )
{
    /*if ( GetAdminLevel( playerid ) < 5 ) // This is for your admin variable
        return 1;*/


    new tempveh1, tempcol1, tempcol2;
    if ( sscanf( params, "iii", tempveh1, tempcol1, tempcol2 ) )
        return SendClientMessage( playerid, -1, "Usage: /veh <CarID> [Color 1] [Color 2]");

    if ( !IsValidVeh( tempveh1 ) )
        return SendClientMessage( playerid, -1, "VEHICLE: Invalid vehicle ID.");

        new Float:pos[ 3 ],Float:a;
        GetPlayerPos( playerid, pos[ 0 ], pos[ 1 ], pos[ 2 ] );
        GetPlayerFacingAngle( playerid, a );
       
        new tempveh;
        tempveh = CreateVehicle( tempveh1, pos[ 0 ], pos[ 1 ], pos[ 2 ], a, tempcol1, tempcol2, -1 );
        PutPlayerInVehicle( playerid, tempveh, 0 );
        return 1;
}
And the IsValidVeh stock:
pawn Код:
stock IsValidVeh(VehicleID)
{
    if( ( VehicleID >= 400 && VehicleID <= 611 ) ) return true;
    return false;
}



Re: Little Help! - Davz*|*Criss - 21.03.2011

Thank you both it worked.