i want if a player type !fight after 4 seconds he teleport to fight zone
here is my code
if ( cmd == "fight" )
{
if ( !player.IsSpawned ) PrivMessage( player, "Error - You hasn't spawned." );
else
{
PrivMessage("Wait for 4 seconds....", player );
NewTimer( "fighter", 4000, 1, player.ID );
Message( ">>" + player.Name + " has gone to fight" );
}
}
and in functions
function fighter(playerID)
{
local player = FindPlayer( playerID )
if ( player )
{
player.Pos = Vector(-540.473, 793.28, 196.393);
}
}
the console gives error message 1 has invalid data type string expected instance.....like this
please explain the error
Use this
if ( cmd == "fight" )
{
if ( !player.IsSpawned ) PrivMessage( player, "Error - You hasn't spawned." );
else
{
PrivMessage(player,"Wait for 4 seconds...." );
NewTimer( "fighter", 4000, 1, player.ID );
}
}
FUNCTION
function fighter(playerID)
{
local player = FindPlayer( playerID )
if ( player )
{
Message( ">>" + player.Name + " has gone to fight" );
player.Pos = Vector(-540.473, 793.28, 196.393);
}
}
Quote from: KAKAN on Jul 14, 2015, 12:18 PMUse this
if ( cmd == "fight" )
{
if ( !player.IsSpawned ) PrivMessage( player, "Error - You hasn't spawned." );
else
{
PrivMessage(player,"Wait for 4 seconds...." );
NewTimer( "fighter", 4000, 1, player.ID );
}
}
FUNCTION
function fighter(playerID)
{
local player = FindPlayer( playerID )
if ( player )
{
Message( ">>" + player.Name + " has gone to fight" );
player.Pos = Vector(-540.473, 793.28, 196.393);
}
}
if ( cmd == "fight" )
{
if ( !player.IsSpawned ) ClientMessage( player, "Error - You hasn't spawned.",player,255,255,0 );
else
{
ClientMessage("Wait for 4 seconds....", player,255,255,0 );
NewTimer( "fighter", 4000, 1, player.ID );
Message( ">>" + player.Name + " has gone to fight" );
}
}
function fighter(plr)
{
local player = FindPlayer( plr )
if ( player )
{
Message( ">>" + player.Name + " has gone to fight" );
player.Pos = Vector(-540.473, 793.28, 196.393);
}
}
PrivMessage doesn't work bro now in vcmp0.4 try this one.:)
You are taking the ID of index's ID's ID....To make it clear you did this.
player.ID.ID;
Which is not going to work.
Quote from: Doom_Killer on Jul 14, 2015, 03:31 PMYou are taking the ID of index's ID's ID....To make it clear you did this.
player.ID.ID;
Which is not going to work.
Well you are my senior , i don't want to make a mess , or something , but i just wanna ask that He is just using "playerID" not "player.ID" in the function sir so how could it be like that?anyway you are right if that occasion would be like that.
Ahm Alex Faris PrivMessage Still Works Just Format is changed
can some one tell me the problem in my code....cuz i dint get it.....and plz explain it
@Axel-Blaz PrivMessage still works in 0.4
try using it like this
PrivMessage ( player, "Your Fking message" );
Quote from: Axel-Blaz on Jul 14, 2015, 03:39 PMWell you are my senior , i don't want to make a mess , or something , but i just wanna ask that He is just using "playerID" not "player.ID" in the function sir so how could it be like that?anyway you are right if that occasion would be like that.
I would appreciate if you would question something from me, you see he is forwarding the
player ID which is player.ID, and when declaring that argument in the timer function, you don't need to use the .ID with the variable, because it is already the .ID. I don't see any mistake in the first post's code but here I re-made it with my way, hope it works.
if ( cmd == "fight" )
{
if ( !player.IsSpawned ) return MessagePlayer( "[#FFFFFF][Error]: You must be spawned to use this command!", player );
else
{
MessagePlayer( "[#FFFFFF]> Teleporting... wait 4 seconds to avoid evading.", player );
NewTimer( "fighter", 4000, 1, player.ID );
}
}
function fighter( p )
{
local player = FindPlayer( p );
if( player )
{
player.Pos = Vector(-540.473, 793.28, 196.393);
Message( "[#FFFFFF][Fight]: " + player.Name + " has gone to fight ( /fight )" );
}
else return;
}
Quote from: Doom_Killer on Jul 14, 2015, 04:39 PMQuote from: Axel-Blaz on Jul 14, 2015, 03:39 PMWell you are my senior , i don't want to make a mess , or something , but i just wanna ask that He is just using "playerID" not "player.ID" in the function sir so how could it be like that?anyway you are right if that occasion would be like that.
I would appreciate if you would question something from me, you see he is forwarding the player ID which is player.ID, and when declaring that argument in the timer function, you don't need to use the .ID with the variable, because it is already the .ID. I don't see any mistake in the first post's code but here I re-made it with my way, hope it works.
if ( cmd == "fight" )
{
if ( !player.IsSpawned ) return MessagePlayer( "[#FFFFFF][Error]: You must be spawned to use this command!", player );
else
{
MessagePlayer( "[#FFFFFF]> Teleporting... wait 4 seconds to avoid evading.", player );
NewTimer( "fighter", 4000, 1, player.ID );
}
}
function fighter( p )
{
local player = FindPlayer( p );
if( player )
{
player.Pos = Vector(-540.473, 793.28, 196.393);
Message( "[#FFFFFF][Fight]: " + player.Name + " has gone to fight ( /fight )" );
}
else return;
}
Actually i was questioning that from you sir anyway alright Sir :)
Quote from: [VSS]Shawn on Jul 14, 2015, 03:58 PMAhm Alex Faris PrivMessage Still Works Just Format is changed
;) Alright i don't know that since i am not really familiar with VCMP0.4 since 2 months , and thanks anyway.
Thankx to all for helping but i still dont know why my code was not working ....?
Quote from: Doom_Killer on Jul 14, 2015, 04:39 PMQuote from: Axel-Blaz on Jul 14, 2015, 03:39 PMWell you are my senior , i don't want to make a mess , or something , but i just wanna ask that He is just using "playerID" not "player.ID" in the function sir so how could it be like that?anyway you are right if that occasion would be like that.
I would appreciate if you would question something from me, you see he is forwarding the player ID which is player.ID, and when declaring that argument in the timer function, you don't need to use the .ID with the variable, because it is already the .ID. I don't see any mistake in the first post's code but here I re-made it with my way, hope it works.
if ( cmd == "fight" )
{
if ( !player.IsSpawned ) return MessagePlayer( "[#FFFFFF][Error]: You must be spawned to use this command!", player );
else
{
MessagePlayer( "[#FFFFFF]> Teleporting... wait 4 seconds to avoid evading.", player );
NewTimer( "fighter", 4000, 1, player.ID );
}
}
function fighter( p )
{
local player = FindPlayer( p );
if( player )
{
player.Pos = Vector(-540.473, 793.28, 196.393);
Message( "[#FFFFFF][Fight]: " + player.Name + " has gone to fight ( /fight )" );
}
else return;
}
spike.