16.06.2012, 15:30
What's bad in this command?
When i type: /lock
Server says: this command do not exist.
But if i not in car, i get that message: "You must be in vehicle".
I think this code is bad, but i don't understand what here is bad:
Here is my /car command:
Код:
enum PlayerDB { owner_name[ MAX_PLAYER_NAME ], bool:Locked } new PlayerData[ MAX_PLAYERS ][ PlayerDB ];
Код:
COMMAND:lock(playerid,params[]) { if(!IsPlayerInAnyVehicle(playerid)) { SendClientMessage( playerid, COLOR_RED,"* You must be in vehicle!"); return 1; } if( CreatedCar[ playerid ] ==-1) { SendClientMessage( playerid, COLOR_RED,"You just can lock car who you self have created with - {FF9900}/car"); return 1; } new vehicleid = CreatedCar[ playerid ]; if( PlayerData[ vehicleid ][ Locked ] == true ) { SendClientMessage( playerid, COLOR_RED,"Vehicle is already locked!"); return 1; } PlayerData[ vehicleid ][ Locked] = true; SendClientMessage( playerid, COLOR_GREEN,"Vehicle was sucefull locked.!"); GetPlayerName( playerid,PlayerData[ vehicleid ][ owner_name ],MAX_PLAYER_NAME); PlayerPlaySound(playerid, 1147, 0.0, 0.0, 0.0); return 1; }
Server says: this command do not exist.
But if i not in car, i get that message: "You must be in vehicle".
I think this code is bad, but i don't understand what here is bad:
Код:
PlayerData[ vehicleid ][ Locked] = true; SendClientMessage( playerid, COLOR_GREEN,"Vehicle was sucefull locked.!"); GetPlayerName( playerid,PlayerData[ vehicleid ][ owner_name ],MAX_PLAYER_NAME); PlayerPlaySound(playerid, 1147, 0.0, 0.0, 0.0);
Код:
COMMAND:car( playerid, params[] ) { new carID[30],Float:X,Float:Y,Float:Z,Float:A; if( sscanf( params, "s[30]", carID ) ) return SendClientMessage( playerid, COLOR_ORANGE, "Usage: /car [Model/Name]"); new Car; if( !IsNumeric(carID)) Car = GetVehicleModelIDFromName(carID); if( IsNumeric(carID)) Car = strval(carID); if( Car < 400 || Car > 611) return SendClientMessage( playerid, COLOR_ORANGE, "Usage: /car [Model/Name (400-611)]" ); GetPlayerPos( playerid, X, Y, Z ); GetPlayerFacingAngle(playerid, A); if( CreatedCar[ playerid ] !=-1) { DestroyVehicle( CreatedCar[ playerid ] ); } CreatedCar[ playerid ] = CreateVehicle( Car, X+3, Y, Z, A, -1, -1, -1 ); new engine,lights,alarm,doors,bonnet,boot,objective; GetVehicleParamsEx(CreatedCar[ playerid ],engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(CreatedCar[ playerid ],1,lights,alarm,doors,bonnet,boot,objective); return 1; }