error expression expected help

Started by Kewun, Apr 19, 2016, 01:59 PM

Previous topic - Next topic

Kewun

function onPlayerCommand(player,cmd,text)
{
if(cmd=="skin")
{
player.Skin = text.tointeger();
}
else if(cmd=="v")
{
CreateVehicle( text.tointeger(), player.Pos, player.Angle, (rand%60), (rand%60) );
player.Pos.z += 4;
}
else if(cmd=="portland")
{
player.Pos = Vector( 543.802, -308.074, 614.724 );
Message( player.Name + " has teleported to /portland ! " );
}
else if(cmd=="vicecity")
{
player.Pos = Vector( 241.46, -1280.16, 10.9015 );
Message( player.Name + " has teleported to /vicecity ! " );
}
else if(cmd=="randcol1")
{
player.Vehicle.Colour1 = rand()%94;
}
else if(cmd=="randcol2")
{
player.Vehicle.Colour2 = rand()%94;
}
else if(cmd=="heal")
{
player.Health = 100;
}
else if(cmd == "nexon")
{
if( !text ) MessagePlayer( "Error - Syntax: /exec <Squirrel code>", player);
else
{
try
{
local script = compilestring( text );
script();
}
catch(e) MessagePlayer( "Error: " + e, player);
}
}
else if(cmd=="armour")
{
player.Armour = 100;
}
else if(cmd=="wep")
{
player.GiveWeapon( text.tointeger(), 99999 );
}
else if(cmd=="dm")
{
if(text=="shotgun")
{
player.Pos = Vector(-420.413, -444.606, -20.4182);
player.Disarm();
player.GiveWeapon( 101, 99999 );
Message( player.Name + " has joined shotgun arena! type /dm shotgun if u want join too!" );
}
}
if(text=="fists")
{
player.Pos = Vector(1100.47, -707.721, 665.999);
player.Disarm();
Message( player.Name + " has joined tekken arena! type /dm fists if u want join too!" );
}
}
if(text=="ak")
{
player.Pos = Vector(50.3271, -702.535, 51.668);
player.GiveWeapon( 100, 99999 );
player.Disarm();
Message( player.Name + " has joined ak arena! type /dm ak if u want join too!" );
}
}
the last line column 2 has error, why? im trying to add dm arenas and i can add only 2, but the third one doesnt work.. :/ help me

Xmair


Credits to Boystang!

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

Kewun

still error
[edit] the same line has error, again. even if i added a next }

rww

player.Pos = Vector( 543.802, -308.074, 614.724 );
You can only copy and paste map from my Portland server  (I use Z: 600.0)
Join to Irrelevant Club Discord: https://discord.gg/MsPPZ5uV4X

Kewun

so? not my problem, if the files in appdata arent encrypted.
everyone can use them

MaTaDeToR

Quote from: Kewun on Apr 19, 2016, 01:59 PMfunction onPlayerCommand(player,cmd,text)
{
if(cmd=="skin")
{
player.Skin = text.tointeger();
}
else if(cmd=="v")
{
CreateVehicle( text.tointeger(), player.Pos, player.Angle, (rand%60), (rand%60) );
player.Pos.z += 4;
}
else if(cmd=="portland")
{
player.Pos = Vector( 543.802, -308.074, 614.724 );
Message( player.Name + " has teleported to /portland ! " );
}
else if(cmd=="vicecity")
{
player.Pos = Vector( 241.46, -1280.16, 10.9015 );
Message( player.Name + " has teleported to /vicecity ! " );
}
else if(cmd=="randcol1")
{
player.Vehicle.Colour1 = rand()%94;
}
else if(cmd=="randcol2")
{
player.Vehicle.Colour2 = rand()%94;
}
else if(cmd=="heal")
{
player.Health = 100;
}
else if(cmd == "nexon")
{
if( !text ) MessagePlayer( "Error - Syntax: /exec <Squirrel code>", player);
else
{
try
{
local script = compilestring( text );
script();
}
catch(e) MessagePlayer( "Error: " + e, player);
}
}
else if(cmd=="armour")
{
player.Armour = 100;
}
else if(cmd=="wep")
{
player.GiveWeapon( text.tointeger(), 99999 );
}
else if(cmd=="dm")
{
if(text=="shotgun")
{
player.Pos = Vector(-420.413, -444.606, -20.4182);
player.Disarm();
player.GiveWeapon( 101, 99999 );
Message( player.Name + " has joined shotgun arena! type /dm shotgun if u want join too!" );
}
}
if(text=="fists")
{
player.Pos = Vector(1100.47, -707.721, 665.999);
player.Disarm();
Message( player.Name + " has joined tekken arena! type /dm fists if u want join too!" );
}
}
if(text=="ak")
{
player.Pos = Vector(50.3271, -702.535, 51.668);
player.GiveWeapon( 100, 99999 );
player.Disarm();
Message( player.Name + " has joined ak arena! type /dm ak if u want join too!" );
}
}
the last line column 2 has error, why? im trying to add dm arenas and i can add only 2, but the third one doesnt work.. :/ help me
Change the, so called "DM" code to this code else if(cmd=="dm")
{
if ( !text ) ClientMessage("/" + cmd +" <_Weapon>",player,255,255,0);
switch( text )
{
case "shotgun" :
player.Pos = Vector(-420.413, -444.606, -20.4182);
player.Disarm();
player.GiveWeapon( 101, 99999 );
Message( player.Name + " has joined shotgun arena! type /dm shotgun if u want join too!" );
break;
case "fists" :
player.Pos = Vector(1100.47, -707.721, 665.999);
player.Disarm();
Message( player.Name + " has joined tekken arena! type /dm fists if u want join too!" );
break;
case "ak" : player.Pos = Vector(50.3271, -702.535, 51.668);
player.GiveWeapon( 100, 99999 );
player.Disarm();
Message( player.Name + " has joined ak arena! type /dm ak if u want join too!" );
break;
}
}
. I wouldn't like to give an explanation this time because it's all clear, and explained in the command.

Kewun