31.07.2012, 16:53
(
Последний раз редактировалось milanosie; 08.08.2012 в 11:33.
Причина: Updated to 0.2
)
Mil-Functions
Version: 0.2
Last update: 08-08-2012
Author: Milanosie
Pastebin: http://pastebin.com/hKDJfKn3
Hello, welcome to Mil-Functions. It's nothing big yet but I'm planning on expanding Mil-Functions on a weekly scale until it contains a good amount of features.
For now, I'm happy with what I got so far.
Functions
All Functions
Added in 0.2
Usage
GetVehicleSpeed
Usage: GetVehicleSpeed(vehicleid, unit)
Parameters: kmh/mph
Example
GetClosestVehicleFromPoint
Usage: GetClosestVehicleFromPoint(Float: x, Float:y, Float:z)
Parameters: x coordinate, y coordinate, z coordinate.
Example
GetClosestVehicleFromPlayer
Usage: GetClosestVehicleFromPlayer(playerid)
Parameters: playerid
Example
GetClosestPlayerFromPoint
Usage: GetClosestPlayerFromPoint(Float: x, Float:y, Float:z)
Parameters: x coordinate, y coordinate, z coordinate.
Example
GetClosestPlayerFromPlayer
Usage: GetClosestPlayerFromPlayer(playerid)
Parameters: playerid
Example
LocalChat
Usage: LocalChat(playerid, Float:range, text[])
Parameters: playerid, range, text
Info: The color of the text depands on the distance of the other players around. The chat will only show for the same virtual world and interior.
Example
GetVehicleType
Usage: GetVehicleType(vehicleid)
Parameters: VehicleID
Info: Returns Model_Car, Model_Bike, Model_Heli, Model_Plane, Model_Unique, Model_Bicycle or Model_Boat
Example
SetVehicleSpeed
Usage: SetVehicleSpeed(vehicleid, km/h)
Parameters: vehicleid, km/h speed
Info: Set the vehicle speed [ONLY sets the speed, not maintains it.]
Example:
This is a very simple example of a cruise control system, just showing an example of the usage of SetVehicleSpeed
ToggleVehicleEngine
Usage: ToggleVehicleEngine(vehicleid)
Parameters: vehicleid
Info: Changes the state of the engine of a vehicle
Example
StopVehicleEngine
Usage: StopVehicleEngine(vehicleid)
Parameters: vehicleid
Info: Stops the vehicle engine
StartVehicleEngine
Usage: StartVehicleEngine(vehicleid)
Parameters: vehicleid
Info: Starts the vehicle engine
Freeze
Usage: Freeze(playerid)
Parameters: playerid
Info: Freezes the player
Unfreeze
Usage: Unfreeze(playerid)
Parameters: playerid
Info: Un Freezes the player
TogFreeze
Usage: TogFreeze(playerid)
Parameters: playerid
Info: Changes the frozen state of the player
Version: 0.2
Last update: 08-08-2012
Author: Milanosie
Pastebin: http://pastebin.com/hKDJfKn3
Hello, welcome to Mil-Functions. It's nothing big yet but I'm planning on expanding Mil-Functions on a weekly scale until it contains a good amount of features.
For now, I'm happy with what I got so far.
Functions
All Functions
pawn Код:
public GetVehicleSpeed(vehicleid, unit);
public GetClosestVehicleFromPoint(Float:x, Float:y, Float:z);
public GetClosestVehicleFromPlayer(playerid);
public GetClosestPlayerFromPlayer(playerid);
public GetClosestPlayerFromPoint(Float:x, Float:y, Float:z);
public LocalChat(playerid, Float:range, text[]);
public GetVehicleType(vehicleid);
public ToggleVehicleEngine(vehicleid);
public StopVehicleEngine(vehicleid);
public StartVehicleEngine(vehicleid);
public Freeze(playerid);
public Unfreeze(playerid);
public TogFreeze(playerid);
public SetVehicleSpeed(vehicleid, Float:speed);
Added in 0.2
pawn Код:
public ToggleVehicleEngine(vehicleid);
public StopVehicleEngine(vehicleid);
public StartVehicleEngine(vehicleid);
public Freeze(playerid);
public Unfreeze(playerid);
public TogFreeze(playerid);
public SetVehicleSpeed(vehicleid, Float:speed);
Usage
GetVehicleSpeed
Usage: GetVehicleSpeed(vehicleid, unit)
Parameters: kmh/mph
Example
pawn Код:
new v = GetPlayerVehicleID(playerid);
new string[128];
format(string, sizeof(string), "You are driving %d KM/h", GetVehicleSpeed(v, kmh));
SendClientMessage(playerid, 0xFFFF00, string);
Usage: GetClosestVehicleFromPoint(Float: x, Float:y, Float:z)
Parameters: x coordinate, y coordinate, z coordinate.
Example
pawn Код:
printf("Closest Vehicle near 323, 100, 5 = %d", GetClosestVehicleFromPoint(323, 100, 5));
GetClosestVehicleFromPlayer
Usage: GetClosestVehicleFromPlayer(playerid)
Parameters: playerid
Example
pawn Код:
printf("Closest Vehicle near [%d] = %d", playerid, GetClosestVehicleFromPlayer(playerid));
Usage: GetClosestPlayerFromPoint(Float: x, Float:y, Float:z)
Parameters: x coordinate, y coordinate, z coordinate.
Example
pawn Код:
printf("Closest PlayerID near 323, 100, 5 = %d", GetClosestPlayerFromPoint(323, 100, 5));
Usage: GetClosestPlayerFromPlayer(playerid)
Parameters: playerid
Example
pawn Код:
printf("Closest PlayerID near [%d] = %d", playerid, GetClosestPlayerFromPlayer(playerid));
Usage: LocalChat(playerid, Float:range, text[])
Parameters: playerid, range, text
Info: The color of the text depands on the distance of the other players around. The chat will only show for the same virtual world and interior.
Example
pawn Код:
public OnPlayerText(playerid, text[])
{
new name[24];
GetPlayerName(playerid, name, 24);
new string[128];
format(string, sizeof(string), "%s says: %s", name, text);
LocalChat(playerid, 25, string);
return 0;
}
Usage: GetVehicleType(vehicleid)
Parameters: VehicleID
Info: Returns Model_Car, Model_Bike, Model_Heli, Model_Plane, Model_Unique, Model_Bicycle or Model_Boat
Example
pawn Код:
CMD:seatbelt(playerid, params[])
{
if(GetVehicleType(vehicleid) != Model_Car) return SendClientMessage(playerid, COLOR_RED, "ERROR: You can only perform this command in a car.");
//rest of the code
}
Usage: SetVehicleSpeed(vehicleid, km/h)
Parameters: vehicleid, km/h speed
Info: Set the vehicle speed [ONLY sets the speed, not maintains it.]
Example:
This is a very simple example of a cruise control system, just showing an example of the usage of SetVehicleSpeed
pawn Код:
new p_speed[MAX_PLAYERS];
public OnPlayerUpdate(playerid)
{
new v = GetPlayerVehicleID(playerid);
if(v != 0)
{
if(cruisecontrol[playerid] == 1)
{
if(p_speed[playerid] == 0)
{
SetVehicleSpeed(vehicleid, 50.0);
p_speed[playerid] = 1;
}
else if(p_speed[playerid] == 1)
{
p_speed[playerid] = 2;
}
else
{
p_speed[playerid] = 0;
}
}
}
return 1;
}
ToggleVehicleEngine
Usage: ToggleVehicleEngine(vehicleid)
Parameters: vehicleid
Info: Changes the state of the engine of a vehicle
Example
pawn Код:
ToggleVehicleEngine(GetPlayerVehicleID(playerid));
Usage: StopVehicleEngine(vehicleid)
Parameters: vehicleid
Info: Stops the vehicle engine
StartVehicleEngine
Usage: StartVehicleEngine(vehicleid)
Parameters: vehicleid
Info: Starts the vehicle engine
Freeze
Usage: Freeze(playerid)
Parameters: playerid
Info: Freezes the player
Unfreeze
Usage: Unfreeze(playerid)
Parameters: playerid
Info: Un Freezes the player
TogFreeze
Usage: TogFreeze(playerid)
Parameters: playerid
Info: Changes the frozen state of the player