Some commands

Started by =RK=MarineForce, May 12, 2018, 08:46 AM

Previous topic - Next topic

=RK=MarineForce

Untested
else if ( cmd == "fps" )
{
if ( !text ) MessagePlayer( "Syntax, /" + cmd + " <Nick/ID>", player );
else {
local plr = FindPlayer( text );
if ( !plr ) MessagePlayer( "[#FF0000]Unknown Player..", player );
else{
Message(" [#00ffff] " + plr.Name + " FPS " + plr.FPS + " ")
}
}
}

else if ( cmd == "ping" )
{
if ( !text ) MessagePlayer( "Syntax, /" + cmd + " <Nick/ID>", player );
else {
local plr = FindPlayer( text );
if ( !plr ) MessagePlayer( "[#FF0000]Unknown Player..", player );
else{
Message(" [#00ffff] " + plr.Name + " Ping " + plr.Ping + " ")
}
}
}


if ( cmd == "spec" )
     {
          local plr = FindPlayer( text );
          if ( !plr.IsSpawned ) MessagePlayer( "[#FF0000]The Player hasn't spawned yet..", player );
          if ( !plr ) MessagePlayer( "Error: [#0000ff] Player '" + text + "' is not online.", player );
          else player.SpectateTarget = plr;
     }

if ( cmd == "exitspec" )
     {
player.SpectateTarget = false;
     }

if u found any bug plz report me :P

Enjoy!

=RK=MarineForce

#1
Change it to findplayer

if it not work than tell me okay


function GetPlayer( plr )
{
    if ( plr )
    {
        if ( IsNum( plr ) )
        {
            plr = FindPlayer( plr.tointeger() );
            if ( plr ) return plr;
            else return false;
        }
     else
        {
            plr = FindPlayer( plr );
            if ( plr ) return plr;
            else return false;
        }
    }
    else return false;
}

function GetTok(string, separator, n, ...)
{
 local m = vargv.len() > 0 ? vargv[0] : n,
    tokenized = split(string, separator),
    text = "";

 if (n > tokenized.len() || n < 1) return null;
 for (; n <= m; n++)
 {
  text += text == "" ? tokenized[n-1] : separator + tokenized[n-1];
 }
 return text;
}

function NumTok(string, separator)
{
 local tokenized = split(string, separator);
 return tokenized.len();
}

updated. i m change it to local plr = FindPlayer( text ); okay.

if its works?

@vito can u give me goto cmd with wait 3 seconds

umar4911

Quote from: =RK=MarineForce on May 12, 2018, 11:11 AMChange it to findplayer

if it not work than tell me okay


function GetPlayer( plr )
{
    if ( plr )
    {
        if ( IsNum( plr ) )
        {
            plr = FindPlayer( plr.tointeger() );
            if ( plr ) return plr;
            else return false;
        }
     else
        {
            plr = FindPlayer( plr );
            if ( plr ) return plr;
            else return false;
        }
    }
    else return false;
}

function GetTok(string, separator, n, ...)
{
 local m = vargv.len() > 0 ? vargv[0] : n,
    tokenized = split(string, separator),
    text = "";

 if (n > tokenized.len() || n < 1) return null;
 for (; n <= m; n++)
 {
  text += text == "" ? tokenized[n-1] : separator + tokenized[n-1];
 }
 return text;
}

function NumTok(string, separator)
{
 local tokenized = split(string, separator);
 return tokenized.len();
}

updated. i m change it to local plr = FindPlayer( text ); okay.

if its works?

@vito can u give me goto cmd with wait 3 seconds
Nice work if you didn't copy. Okay, since you know less about coding, I prefer you try making yourself and if found any error, then make a post. Just begging for code is not a good thing and you cannot become a good scripter. When I started scripting, I tried hard and now, I can make very complex cmds for myself.
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

=RK=MarineForce

#3
functions give me by mohammed


i not teach script for wiki and I don't know more much make hard cmds and function since i m member of 2015 scripting. my enligsh is bad
u remember u teach me how to make fix cmd remember i make it by your teaching goto fix heal armour

Mahmoud Tornado

Quote from: =RK=MarineForce on May 12, 2018, 04:41 PMfunctions give me by mohammed


i not teach script for wiki and I don't know more much make hard cmds and function since i m member of 2015 scripting. my enligsh is bad
u remember u teach me how to make fix cmd remember i make it by your teaching goto fix heal armour

Bro you can understand everything by yourself, I'm was bad scripter and always asking for scripts, but my friend said that you will never make your life good if you live for asking people to help you, you must create yourself and always know that you can make any thing impossible as you can make it possible. Just believe yourself.

My friend who said that was @KuRiMi and he was right about everything he said and now look who I am?

=RK=MarineForce

how to learn vc-mp script?

=RK=MarineForce

Perfect script i can make only easy cmds and  functions and system

Mahmoud Tornado


Xmair

Just try yourself. Grab the required functions from the wiki. If you get into an error. Try understanding what the error says and try to fix it. If you still can't do it then create a topic on the forum. This is how I personally learned scripting.

Credits to Boystang!

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

umar4911

Quote from: Xmair on May 13, 2018, 04:48 AMJust try yourself. Grab the required functions from the wiki. If you get into an error. Try understanding what the error says and try to fix it. If you still can't do it then create a topic on the forum. This is how I personally learned scripting.
I did the same. First, I used wiki to get demo functions and basic scripts. I tried my best to make own function. If error encountered, tried to solve it by myself but if failed, made a topic on forum and post the code and error. This way, I get to know how to make own script and do error analysis.

 I will update the wiki in a manner that you will be able to understand every function.
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

=RK=MarineForce

#10
Thanks for support if i don't understand i will tell u i understand and learn more things from wiki

im kid so i dont understand much but i will learn soon

=RK=MarineForce

shhh

what is this lol

function onPlayerEnterVehicle( player, vehicle, door )
{
    MessagePlayer( "Entered In: [" + GetVehicleModelFromName( GetVehicleNameFromModel( vehicle.Model )) + "]",player);
    return 1;
}

by me its good?

" + GetVehicleNameFromModel(); + "

" + GetVehicleNameFromModel(player.Vehicle); + "

umar4911

Quote from: =RK=MarineForce on May 13, 2018, 08:41 AMshhh

what is this lol

function onPlayerEnterVehicle( player, vehicle, door )
{
    MessagePlayer( "Entered In: [" + GetVehicleModelFromName( GetVehicleNameFromModel( vehicle.Model )) + "]",player);
    return 1;
}

by me its good?

" + GetVehicleNameFromModel(); + "

" + GetVehicleNameFromModel(player.Vehicle); + "
The output will be that if you added a pcj, it will show "entered in: 191".

Only use GetVehicleNameFromModel(vehicle.Model)
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

=RK=MarineForce

why? my showing only id?

Vehicle.Model Thanks

=RK=MarineForce

#14
Untested

else if ( cmd == "marker" )
{
CreateMarker(player.UniqueWorld, Vector( player.Pos.X, player.Pos.Y,  ), 5,RGB(209, 209, 209),0);
}

Example by Wiki

PlaySound( world, sound, pos )

PlaySound(player.UniqueWorld, 3, player.Pos.X, player.Pos.Y );

its make by me if u got any bug report me untested

new cmd example by wiki.

PlaySoundForWorld(WorldID,SoundID) Example by wiki

I make it at 30 minutes. more bugs in this cmd i think.

Untested.

else if ( cmd == "soundpl" )
{
if(!text);
{
local World = FindWorld(text);
local Sound = FindSoundID();
PlaySoundForWorld(World.ID, text.tointeger());
}
else MessagePlayer(" " + cmd + " World ID SounID ", player);
}

if i learn phyton i know all things?