Hi Friends Now I Was Testing New Files In My Server And When I End I Saw The Goto And Heal And Fix Commands Need Timers
So I Made Then With Some Help From
@DarkRaZoR^ In NewTimer
Heal Command
else if ( cmd == "heal" )
{
if ( !player.IsSpawned ) MessagePlayer( "[#ff0000]Error - You haven't spawned yet..", player );
else if ( player.Health == 100 ) MessagePlayer( "[#ff0000]Error - You don't need to be healed", player );
else {
NewTimer( "heal", 3000, 1, player.ID );
Announce( "Healing...", player , 0 );
player.IsFrozen = true;
MessagePlayer( "[#ffbb00]You Will Be Healed In 3 Seconds.", player );
}
}
Heal Function
function heal(p)
{
local player = FindPlayer(p);
if (player) {
player.IsFrozen = false;
player.Health = 100;
MessagePlayer( "[#ffbb00]You Have Been Healed.", player );
}
}
Goto Command
else if ( cmd == "goto" )
{
if ( !text ) MessagePlayer( "[#ff0000]Syntax - /" + cmd + " <Player Nick/ID>", player );
else {
local plr = GetPlayer( text );
if ( !plr ) MessagePlayer( "[#ff0000]Error - Unknown Player..", player );
else if ( plr.ID == player.ID ) MessagePlayer( "[#ff0000]Error - You can't teleport to yourself!", player );
else if ( !plr.IsSpawned ) MessagePlayer( "[#ff0000]Error - The Player hasn't spawned yet..", player );
else {
NewTimer( "goto", 3000, 1, player.ID, plr.ID );
Announce( "Teleporting...", player , 0 );
player.IsFrozen = true;
MessagePlayer( "[#ffbb00]You Will Be Teleported In 3 Seconds To " + plr.Name + ". ", player);
}
}
}
Goto Function
function goto(player, plr)
{
player = FindPlayer( player );
plr = FindPlayer( plr );
if( player && plr )
{
Message( "[#25e805]Information: [#f2f2f2]" + player + " has teleported to " + plr + "." );
player.IsFrozen = false;
player.Pos = plr.Pos;
}
}
Fix Command
else if ( cmd == "fix" )
{
local veh = player.Vehicle;
if ( !veh ) MessagePlayer( "[#ff0000]Error - You must be in a Vehicle.", player );
else if ( veh.Health == 1000 ) MessagePlayer( "[#ff0000]Error - Your Vehicle is already fixed..", player );
else if ( veh.Health == 100 ) MessagePlayer( "[#ff0000]Error - Your Vehicle is already fixed..", player );
else {
Announce( "Fixing...", player , 0 );
player.IsFrozen = true;
NewTimer( "Fix", 3000, 1, player.ID );
MessagePlayer( "[#ffbb00]Your Car Will Be Fixed in 3 Seconds", player );
}
}
Fix Function
function Fix(p)
{
local player = FindPlayer(p);
if (player) {
local veh = player.Vehicle;
if(veh) {
player.IsFrozen = false;
player.Vehicle.Fix();
MessagePlayer( "[#ffbb00]Your Vehice Has Been Fixed", player );
}
}
}
Thx
MahmoudTornado.
Quote from: Mahmoud Tornado on Sep 11, 2017, 09:15 AMGoto Function
function goto(player, plr)
{
player = FindPlayer( player );
plr = FindPlayer( plr );
if( player && plr )
{
Message( "[#25e805]Information: [#f2f2f2]" + player + " has teleported to " + plr + ".", player);
player.IsFrozen = false;
player.Pos = plr.Pos;
}
}
Fix Command
else if ( cmd == "fix" )
{
local veh = player.Vehicle;
if ( !veh ) MessagePlayer( "[#ff0000]Error - You must be in a Vehicle.", player );
else if ( veh.Health == 1000 ) MessagePlayer( "[#ff0000]Error - Your Vehicle is already fixed..", player );
else if ( veh.Health == 100 ) MessagePlayer( "[#ff0000]Error - Your Vehicle is already fixed..", player );
else {
Announce( "Fixing...", player , 0 );
player.IsFrozen = true;
NewTimer( "Fix", 3000, 1, player.ID );
MessagePlayer( "[#ffbb00]Your Car Will Be Fixed in 3 Seconds", player );
}
}
First of all, it's my plessure. Secondly, you missed the keywords
local at your goto function. Furthermore, why did you include a if statemt defining if your vehicle has 100hp and 1000hp both in the code? Suggest to remove the one with 100hp since vehicles has a full of 1000hp.
@DarkRaZoR^ there's no need for a local variable in his goto function.
Quote from: DarkRaZoR^ on Sep 11, 2017, 04:38 PMQuote from: Mahmoud Tornado on Sep 11, 2017, 09:15 AMGoto Function
function goto(player, plr)
{
player = FindPlayer( player );
plr = FindPlayer( plr );
if( player && plr )
{
Message( "[#25e805]Information: [#f2f2f2]" + player + " has teleported to " + plr + ".", player);
player.IsFrozen = false;
player.Pos = plr.Pos;
}
}
Fix Command
else if ( cmd == "fix" )
{
local veh = player.Vehicle;
if ( !veh ) MessagePlayer( "[#ff0000]Error - You must be in a Vehicle.", player );
else if ( veh.Health == 1000 ) MessagePlayer( "[#ff0000]Error - Your Vehicle is already fixed..", player );
else if ( veh.Health == 100 ) MessagePlayer( "[#ff0000]Error - Your Vehicle is already fixed..", player );
else {
Announce( "Fixing...", player , 0 );
player.IsFrozen = true;
NewTimer( "Fix", 3000, 1, player.ID );
MessagePlayer( "[#ffbb00]Your Car Will Be Fixed in 3 Seconds", player );
}
}
First of all, it's my plessure. Secondly, you missed the keywords local at your goto function. Furthermore, why did you include a if statemt defining if your vehicle has 100hp and 1000hp both in the code? Suggest to remove the one with 100hp since vehicles has a full of 1000hp.
Okay I UnderStood
Quote from: Xmair on Sep 11, 2017, 05:05 PM@DarkRaZoR^ there's no need for a local variable in his goto function.
Hmm Okay.
HEY Man i have to fixed this goto cmd
else if ( cmd == "goto" )
{
if ( !text ) MessagePlayer( "[#ff0000]Syntax - /" + cmd + " <Player Nick/ID>", player );
else {
local plr = FindPlayer( text );
if ( !plr ) MessagePlayer( "[#ff0000]Error - Unknown Player..", player );
else if ( plr.ID == player.ID ) MessagePlayer( "[#ff0000]Error - You can't teleport to yourself!", player );
else if ( !plr.IsSpawned ) MessagePlayer( "[#ff0000]Error - The Player hasn't spawned yet..", player );
else {
NewTimer( "goto", 3000, 1, player.ID, plr.ID );
Announce( "Teleporting...", player , 0 );
player.IsFrozen = true;
MessagePlayer( "[#ffbb00]You Will Be Teleported In 3 Seconds To " + plr.Name + ". ", player);
}
}
}
Change this Local plr = GetPlayer(text);
to Local plr = FindPlayer ( text );
its work for me when i fixed it
Quote from: =RK=MarineForce on May 11, 2018, 06:23 PMHEY Man i have to fixed this goto cmd
else if ( cmd == "goto" )
{
if ( !text ) MessagePlayer( "[#ff0000]Syntax - /" + cmd + " <Player Nick/ID>", player );
else {
local plr = FindPlayer( text );
if ( !plr ) MessagePlayer( "[#ff0000]Error - Unknown Player..", player );
else if ( plr.ID == player.ID ) MessagePlayer( "[#ff0000]Error - You can't teleport to yourself!", player );
else if ( !plr.IsSpawned ) MessagePlayer( "[#ff0000]Error - The Player hasn't spawned yet..", player );
else {
NewTimer( "goto", 3000, 1, player.ID, plr.ID );
Announce( "Teleporting...", player , 0 );
player.IsFrozen = true;
MessagePlayer( "[#ffbb00]You Will Be Teleported In 3 Seconds To " + plr.Name + ". ", player);
}
}
}
Change this Local plr = GetPlayer(text);
to Local plr = FindPlayer ( text );
its work for me when i fixed it
As you don't have GetPlayer Function.
FindPlayer is an normal function.
The both work but you don't have GetPlayer Function.
can u give me it ?
can some one give me getall cmd?
Quote from: =RK=MarineForce on May 11, 2018, 08:01 PMcan u give me it ?
First GetPlayer Function
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;
}
Quote from: =RK=MarineForce on May 11, 2018, 08:01 PMcan some one give me getall cmd?
Second, if you want any thing, you Can ask here
https://forum.vc-mp.org/?board=37.0
But anyway here you are
else if ( cmd == "getall" )
{
if ( Stats[ player.ID ].Level < 4 ) MessagePlayer( "[#00de00]Inforamtion: [#fbf3f3]You are not authorized to use this command.", player );
else if ( Stats[ player.ID ].Log == false ) MessagePlayer( "[#00de00]Inforamtion: [#fbf3f3]you need to be logged in.", player );
else{
Message("[#00de00]Administration Command: [#fbf3f3]Admin "+player.Name+" has got all players to his location.");
for (local i=0; i<GetMaxPlayers(); i++)
{
local p=FindPlayer(i);
if(p)
{
p.Pos = player.Pos;
}
}
}
}
Function OnGetPlayer
{
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;
}
No Working >>
Thanks for Getall Cmd.
but it working without function <3
Quote from: =RK=MarineForce on May 12, 2018, 07:10 AMFunction OnGetPlayer
{
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;
}
No Working >>
WTF?!!
function GetPlayer( plr )
Quote from: vitogta on May 12, 2018, 09:26 PMusing NewTimer per each operation in your server keep in mind there is a limit of native timers instances around 128
then what should we do in that situation.
I m trying to make itThanks For Support I will try hard okay :D
Quote from: Mahmoud Tornado on May 11, 2018, 07:16 PMQuote from: =RK=MarineForce on May 11, 2018, 06:23 PMHEY Man i have to fixed this goto cmd
else if ( cmd == "goto" )
{
if ( !text ) MessagePlayer( "[#ff0000]Syntax - /" + cmd + " <Player Nick/ID>", player );
else {
local plr = FindPlayer( text );
if ( !plr ) MessagePlayer( "[#ff0000]Error - Unknown Player..", player );
else if ( plr.ID == player.ID ) MessagePlayer( "[#ff0000]Error - You can't teleport to yourself!", player );
else if ( !plr.IsSpawned ) MessagePlayer( "[#ff0000]Error - The Player hasn't spawned yet..", player );
else {
NewTimer( "goto", 3000, 1, player.ID, plr.ID );
Announce( "Teleporting...", player , 0 );
player.IsFrozen = true;
MessagePlayer( "[#ffbb00]You Will Be Teleported In 3 Seconds To " + plr.Name + ". ", player);
}
}
}
Change this Local plr = GetPlayer(text);
to Local plr = FindPlayer ( text );
its work for me when i fixed it
As you don't have GetPlayer Function.
FindPlayer is an normal function.
The both work but you don't have GetPlayer Function.
Whenever i use the cmd, it says wait 3s but i wait too much and doesnt working
Quote from: nippon on Jul 02, 2018, 12:44 AMQuote from: Mahmoud Tornado on May 11, 2018, 07:16 PMQuote from: =RK=MarineForce on May 11, 2018, 06:23 PMHEY Man i have to fixed this goto cmd
else if ( cmd == "goto" )
{
if ( !text ) MessagePlayer( "[#ff0000]Syntax - /" + cmd + " <Player Nick/ID>", player );
else {
local plr = FindPlayer( text );
if ( !plr ) MessagePlayer( "[#ff0000]Error - Unknown Player..", player );
else if ( plr.ID == player.ID ) MessagePlayer( "[#ff0000]Error - You can't teleport to yourself!", player );
else if ( !plr.IsSpawned ) MessagePlayer( "[#ff0000]Error - The Player hasn't spawned yet..", player );
else {
NewTimer( "goto", 3000, 1, player.ID, plr.ID );
Announce( "Teleporting...", player , 0 );
player.IsFrozen = true;
MessagePlayer( "[#ffbb00]You Will Be Teleported In 3 Seconds To " + plr.Name + ". ", player);
}
}
}
Change this Local plr = GetPlayer(text);
to Local plr = FindPlayer ( text );
its work for me when i fixed it
As you don't have GetPlayer Function.
FindPlayer is an normal function.
The both work but you don't have GetPlayer Function.
Whenever i use the cmd, it says wait 3s but i wait too much and doesnt working
Did you change GetPlayer to FindPlayer or you have the GetPlayer function?
https://imgur.com/a/qdLE10V
Quote from: nippon on Jul 02, 2018, 02:56 AMhttps://imgur.com/a/qdLE10V
what is the error om console?
Stop using the MS Notepad for scripting. Use PawnoX, Notepad++ or VS .
https://imgur.com/a/xiJuP2o
Quote from: umar4911 on Jul 02, 2018, 05:17 AMQuote from: nippon on Jul 02, 2018, 02:56 AMhttps://imgur.com/a/qdLE10V
what is the error om console?
Check this: https://www.youtube.com/watch?v=EhkEXKCjFmc&feature=youtu.be
Quote from: nippon on Jul 02, 2018, 01:50 PMQuote from: umar4911 on Jul 02, 2018, 05:17 AMQuote from: nippon on Jul 02, 2018, 02:56 AMhttps://imgur.com/a/qdLE10V
what is the error om console?
Check this: https://www.youtube.com/watch?v=EhkEXKCjFmc&feature=youtu.be
you added the command but did you add goto function?
See the code and copy that.
https://imgur.com/a/NfVB8ZU
Quote from: nippon on Jul 02, 2018, 03:28 PMhttps://imgur.com/a/NfVB8ZU
What is the error on console(server.exe)?
(https://imgur.com/a/R9SC5f1)
https://imgur.com/a/R9SC5f1
and check the script line 37 https://imgur.com/a/9P8J4nc
put this for best pickup.RespawnTime = 1000;
player.IsFrozen = true;
This goto function can freeze the player "forever".
if (player && plr)
If plr leaves the server while the player is teleporting, it may freeze you as there is no other condition that only involves plr.
I think this would be a best alternative (also some adjustments to the goto function):
function goto(playerid, plrid) {
local player = FindPlayer(playerid), plr = FindPlayer(plrid);
if (player) {
if (plr) {
player.IsFrozen = false;
player.Pos = plr.Pos;
Message( "[#25e805]Information: [#f2f2f2]" + player + " has teleported to " + plr + "." );
}
else {
player.IsFrozen = false;
MessagePlayer("Error, plr has left!", player);
}
}
}