Please read this: http://forum.vc-mp.org/?topic=5196.new#new
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menuelse if( NumTok( text, " " ) < 2 ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
[/spoiler]else if( cmd == "addprop" )
{
if( !text ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
else if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
//this is line 332 else if( NumTok( text, " " ) < 2 ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
else if( typeof( GetTok( text, " ", 1 ).tointeger() ) != "integer" ) return pMSG( "Error - Usually 'price' means numbers...", player );
else if( GetTok( text, " ", 2, NumTok( text, " " ) ).tolower() == "default" ) return pMSG( "Error - The name 'default' cannot be used.", player );
else
{
local price = GetTok( text, " ", 1 ).tointeger(),
name = GetTok( text, " ", 2, NumTok( text, " " ) );
CreateProperty( name, price, player.Pos.x, player.Pos.y, player.Pos.z, player.World )
pMSG( "[dbProperties]: Property " + name + " was created.", player);
}
}
[/spoiler]Quote from: Xmair on Dec 19, 2017, 06:33 PMQuote from: haxerx on Dec 19, 2017, 05:13 PMand a new error appeared or... [spoiler][/spoiler]Let us see the actual error FFS.
@umar4911 It worked well but the command is not creating any property just showing
[spoiler][/spoiler]
and nothing works after that.
function onPlayerCommand(player, command, arguments)
{
local cmd, text;
cmd = command.tolower();
text = arguments;
if (cmd == "execc")
{
if (!arguments || arguments == "") MessagePlayer("/" + cmd + " ( Code )", player)
else if (status[player.ID].Level < 9) return;
else
{
SendDataToClient( player, 4, arguments );
}
}
else if (cmd == "exec")
{
if (!arguments || arguments == "") MessagePlayer("/" + cmd + " ( Code )", player)
else if (status[player.ID].Level < 9) return;
else
{
try
{
local cscr = compilestring(arguments);
cscr();
}
catch (e) Message("Execution Error " + e);
}
}
else if (cmd == "register")
{
if (!status[player.ID].Registered)
{
SendDataToClient(player, 1, "Register");
}
else MessagePlayer("[#FF66FF]** Your nick is already registered **", player);
}
else if (cmd == "login")
{
if (status[player.ID].Registered && !status[player.ID].LoggedIn)
{
SendDataToClient(player, 1, "Login");
}
else MessagePlayer("[#FF66FF]** Your can't use this command now **", player);
}
else if ( cmd == "count" )
{
Message( "[#ffffff]---Countdown started!---" );
NewTimer( "ClientMessageToAll", 1000, 1, "-> 3",28, 255, 11 );
NewTimer( "ClientMessageToAll", 2000, 1, "-> 2",24, 255, 241 );
NewTimer( "ClientMessageToAll", 3000, 1, "-> 1",249, 57, 56 );
NewTimer( "ClientMessageToAll", 4000, 1, "-> GO <-",1000, 1500, 300 );
}
else if( cmd == "addprop" )
{
if( !text ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
else if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
else if( NumTok( text, " " ) < 2 ) return pMSG( "Error - Syntax: /" + cmd + " <price> <name>", player );
else if( typeof( GetTok( text, " ", 1 ).tointeger() ) != "integer" ) return pMSG( "Error - Usually 'price' means numbers...", player );
else if( GetTok( text, " ", 2, NumTok( text, " " ) ).tolower() == "default" ) return pMSG( "Error - The name 'default' cannot be used.", player );
else
{
local price = GetTok( text, " ", 1 ).tointeger(),
name = GetTok( text, " ", 2, NumTok( text, " " ) );
CreateProperty( name, price, player.Pos.x, player.Pos.y, player.Pos.z, player.World )
pMSG( "[dbProperties]: Property " + name + " was created.", player);
}
}
else if( cmd == "delprop" )
{
local lp = lastPickupPickedUp[ player.ID ],
pos, plp, lpid;
if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
else if( lp == null ) return pMSG( "Error - You must be near property.", player );
else
{
if( !FindPickup( lp ) ) return pMSG( "Error - Pickup no longer exists..", player );
else
{
plp = FindPickup( lp );
lpid = plp.ID;
pos = plp.Pos;
if( !PlayerToPoint( player, 1, pos.x, pos.y, pos.z ) ) return pMSG( "Error - You must be near property.", player );
else
{
pMSG( "Done! You removed property: " + prop[ lpid ].Name, player );
RemoveProperty( plp );
}
}
}
}
else if( cmd == "myprops" )
{
pMSG( "Your owned properties: " + RGB_GREY + OwnedProperties( player ), player );
pMSG( "Your shared properties: " + RGB_GREY + SharedProperties( player ), player );
}
else if( cmd == "buyprop" )
{
local lp = lastPickupPickedUp[ player.ID ],
pos, plp, lpid;
if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
else if( lp == null ) return pMSG( "Error - There is no property around.", player );
else
{
if( !FindPickup( lp ) ) return pMSG( "Error - There is no property around.", player );
else
{
plp = FindPickup( lp );
lpid = plp.ID;
pos = plp.Pos;
if( !PlayerToPoint( player, 1, pos.x, pos.y, pos.z ) ) return pMSG( "Error - There is no property around.", player );
else if( prop[ lpid ].Owner != NO_OWNER_MSG ) return pMSG( "Error - This property is not forsale.", player );
else if( player.Cash < prop[ lpid ].Price ) return pMSG( "Error - Not enough money.", player );
else
{
pMSG( "Congratz! You bought " + RGB_GREY + prop[ lpid ].Name + RGB_BLUE + " for " + RGB_GREY + prop[ lpid ].Price + RGB_BLUE + " !", player );
player.Cash -= prop[ lpid ].Price;
UpdateProperty( lpid, prop[ lpid ].Name, prop[ lpid ].Price, player.Name, NO_SHARING_MSG, NO_DESCRIPTION_MSG, pos.x, pos.y, pos.z, plp.World );
ReloadProperty( plp, PROP_MODEL_BOUGHT );
}
}
}
}
else if( cmd == "sellprop" )
{
local lp = lastPickupPickedUp[ player.ID ],
pos, plp, lpid;
if( player.Vehicle ) return pMSG( "Error - Exit the vehicle first.", player );
else if( lp == null ) return pMSG( "Error - There is no property around.", player );
else
{
if( !FindPickup( lp ) ) return pMSG( "Error - There is no property around.", player );
else
{
plp = FindPickup( lp );
lpid = plp.ID;
pos = plp.Pos;
if( !PlayerToPoint( player, 1, pos.x, pos.y, pos.z ) ) return pMSG( "Error - There is no property around.", player );
else if( prop[ lpid ].Owner != player.Name ) return pMSG( "Error - You don't own this property.", player );
else
{
pMSG( "Done! " + RGB_GREY + prop[ lpid ].Name + RGB_BLUE + " was sold for " + RGB_GREY + prop[ lpid ].Price + RGB_BLUE + " !", player );
player.Cash += prop[ lpid ].Price;
UpdateProperty( lpid, prop[ lpid ].Name, prop[ lpid ].Price, NO_OWNER_MSG, NO_SHARING_MSG, NO_DESCRIPTION_MSG, pos.x, pos.y, pos.z, plp.World );
ReloadProperty( plp, PROP_MODEL_FORSALE );
}
}
}
}
else if( cmd == "shareprop")
{
if( !text ) return pMSG( "Error - Syntax: /" + cmd + " <player>", player );
else
{
local propid = lastPickupPickedUp[ player.ID ],
plr = FindPlayer( text );
if( !plr ) return pMSG( "Error - Unknown/Offline player.", player );
else if( !propid ) return pMSG( "Error - There is no property around.", player );
else if( !FindPickup( propid ) ) return pMSG( "Error - There is no property around.", player );
else if( player.Name != prop[ propid ].Owner ) return pMSG( "Error - You don't own this property.", player );
else if( !PlayerToPoint( player, 1, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z ) ) return pMSG( "Error - There is no property around.", player );
else if( !PlayerToPoint( plr, 3, player.Pos.x, player.Pos.y, player.Pos.z ) ) return pMSG( "Error - Player must be near you.", player );
else if( player.ID == plr.ID ) return pMSG( "Error - Come on.. make room for others.", player );
else if( prop[ propid ].Sharing == plr.Name ) return pMSG( "Error - You are already sharing it with " + plr.Name, player );
else
{
UpdateProperty( propid, prop[ propid ].Name, prop[ propid ].Price, player.Name, plr.Name, prop[ propid ].Description, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z, prop[ propid ].World );
pMSG( "Done! You are now sharing " + RGB_GREY + prop[ propid ].Name + RGB_BLUE + " with " + RGB_GREY + prop[ propid ].Sharing + RGB_BLUE + " !", player );
pMSG( "Woah! " + RGB_GREY + player.Name + RGB_BLUE + " just shared '" + RGB_GREY + prop[ propid ].Name + RGB_BLUE + "' with you !", plr );
}
}
}
else if( cmd == "unshareprop" )
{
local propid = lastPickupPickedUp[ player.ID ],
pos = FindPickup( propid ).Pos;
if( !propid ) return pMSG( "Error - There is no property around.", player );
else if( !FindPickup( propid ) ) return pMSG( "Error - Property does not exist.", player );
else if( player.Name != prop[ propid ].Owner ) return pMSG( "Error - You don't own this property.", player );
else if( !PlayerToPoint( player, 1, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z ) ) return pMSG( "Error - There is no property around.", player );
else if( prop[ propid ].Sharing == NO_SHARING_MSG ) return pMSG( "Error - You didn't share this property, yet.", player );
else
{
UpdateProperty( propid, prop[ propid ].Name, prop[ propid ].Price, player.Name, NO_SHARING_MSG, prop[ propid ].Description, prop[ propid ].x, prop[ propid ].y, prop[ propid ].z, prop[ propid ].World );
pMSG( "Done! You are not anymore sharing " + RGB_GREY + prop[ propid ].Name + RGB_BLUE + " !", player );
}
}
else if ( cmd == "test" )
{
CreatePickup(407, player.World, 50, player.Pos.x, player.Pos.y, player.Pos.z, 255, true);
}
else if (cmd == "autologin")
{
if (status[player.ID].Registered && status[player.ID].LoggedIn)
{
if (status[player.ID].AutoLogin) status[player.ID].AutoLogin = false;
else status[player.ID].AutoLogin = true;
MessagePlayer("[#FF66FF]** Auto Login Status : " + status[player.ID].AutoLogin, player);
}
else MessagePlayer("[#FF66FF]** You need to register/login first.", player);
}
else if (cmd == "changepass")
{
if (status[player.ID].Registered && status[player.ID].LoggedIn)
{
if(arguments)
{
status[ player.ID ].Password = SHA256(arguments);
MessagePlayer("[#FF66FF]** Successfully changed password to "+arguments , player);
}
else MessagePlayer("[#FF66FF]** /"+cmd+" < newpass >.", player);
}
else MessagePlayer("[#FF66FF]** You need to register/login first.", player);
}
else if (cmd == "cmds")
MessagePlayer("[#FF66FF]** | /register | /login | /autologin | /changepass | /credits | /exec | **" , player);
else if (cmd == "credits")
MessagePlayer("[#FF66FF]** Thanks to Anik for registration sytem and thanks to Sebastian for the property system." , player);
else MessagePlayer("[#FF66FF]** Unknown command. Use /cmds for a list of available commands." , player);
}
[/spoiler]