Vice City: Multiplayer

Server Development => Scripting and Server Management => Snippet Showroom => Topic started by: =RK=MarineForce on May 12, 2018, 08:46 AM

Title: Some commands
Post by: =RK=MarineForce on May 12, 2018, 08:46 AM
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!
Title: Re: Some commands
Post by: =RK=MarineForce on May 12, 2018, 11:11 AM
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
Title: Re: Some commands
Post by: umar4911 on May 12, 2018, 03:04 PM
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.
Title: Re: Some commands
Post by: =RK=MarineForce on May 12, 2018, 04:41 PM
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
Title: Re: Some commands
Post by: Mahmoud Tornado on May 12, 2018, 07:23 PM
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?
Title: Re: Some commands
Post by: =RK=MarineForce on May 12, 2018, 07:36 PM
how to learn vc-mp script?
Title: Re: Some commands
Post by: =RK=MarineForce on May 12, 2018, 07:36 PM
Perfect script i can make only easy cmds and  functions and system
Title: Re: Some commands
Post by: Mahmoud Tornado on May 12, 2018, 10:22 PM
Quote from: =RK=MarineForce on May 12, 2018, 07:36 PMhow to learn vc-mp script?
From
wiki.vc-mp.org
And our examples on this forum.
Title: Re: Some commands
Post by: Xmair on May 13, 2018, 04:48 AM
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.
Title: Re: Some commands
Post by: umar4911 on May 13, 2018, 04:58 AM
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.
Title: Re: Some commands
Post by: =RK=MarineForce on May 13, 2018, 08:39 AM
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
Title: Re: Some commands
Post by: =RK=MarineForce on May 13, 2018, 08:41 AM
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); + "
Title: Re: Some commands
Post by: umar4911 on May 13, 2018, 08:51 AM
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)
Title: Re: Some commands
Post by: =RK=MarineForce on May 13, 2018, 09:28 AM
why? my showing only id?

Vehicle.Model Thanks
Title: Re: Some commands
Post by: =RK=MarineForce on May 13, 2018, 09:36 AM
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?
Title: Re: Some commands
Post by: Mohamed Boubekri on May 13, 2018, 09:58 AM
Quote from: =RK=MarineForce on May 13, 2018, 09:36 AMUntested

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?
Use This:
else if ( cmd == "soundpl" )
{
if(!text) MessagePlayer(" " + cmd + " World ID SounID ", player);
else {
PlaySoundForWorld(player.World, text.tointeger());
}
}
Title: Re: Some commands
Post by: =RK=MarineForce on May 13, 2018, 10:05 AM

Mohamed

PlaySoundForWorld(player.World, text.tointeger());
its playSound on Player.World ?
Title: Re: Some commands
Post by: =RK=MarineForce on Jul 19, 2018, 12:36 PM
can u tell me

what is   if ( IsNum( plr ) ) and return false;