
at the top left of the page and the code will look something like:CreateObject(975, 2053.16, -1762.77, 14.25, 0.00, 0.00, 0.00);
CreateObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ, Float:DrawDistance);
modelid The model you want to use.
Float:X The X coordinate to create the object at.
Float:Y The Y coordinate to create the object at.
Float:Z The Z coordinate to create the object at.
Float:rX The X rotation of the object.
Float:rY The Y rotation of the object.
Float:rZ The Z rotation of the object.
Float:DrawDistance (optional) The distance that San Andreas renders objects. 0.0 will cause objects to render at their default distances. 300.0 is the usable maximum. Usable since 0.3b.
Returns The ID of the object that was created.

CreateObject(975, 2047.22, -1762.77, 14.25, 0.00, 0.00, 0.00)
public OnGameModeInit(){
CreateObject(975, 2053.16, -1762.77, 14.25, 0.00, 0.00, 0.00);
}
New gate;
|
#include <core> #include <float> #include <string> #include <file> #include <time> #include <datagram> #include <a_players> #include <a_vehicles> #include <a_objects> #include <a_sampdb> |
gate=CreateObject(975, 2053.16, -1762.77, 14.25, 0.00, 0.00, 0.00);
if(strcmp(cmdtext,"/opengate",true)==0 || strcmp(cmdtext,"/og",true)==0){
return 1;
}
strcmp(const string1[], const string2[], bool:ignorecase, length)
string1 The first string to compare.
string2 The second string to compare.
ignorecase (optional) When set to true, the case doesn't matter - HeLLo is the same as Hello. When false, they're not the same.
length (optional) When this length is set, the first x chars will be compared - doing "Hello" and "Hell No" with a length of 4 will say it's the same string.
Returns -1 if string1 comes before string2
1 if string1 comes after string2
0 if the strings are the same (for the matched length).
IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z) playerid The ID of the player you want to check the point range of. Float:range The furthest distance the player can be to be in range. Float:x The X coordinate of the point to check the range to. Float:y The Y coordinate of the point to check the range to. Float:z The Z coordinate of the point to check the range to. Returns 1 if the player is in range of the point, otherwise 0.
if(strcmp(cmdtext,"/opengate",true)==0 || strcmp(cmdtext,"/og",true)==0){
if (IsPlayerInRangeOfPoint(playerid,30, 2053.16, -1762.77, 14.25)){
//The player is near the gate.
}else{
//The player is not near the gate.
}
return 1;
}
MoveObject(objectid, Float:X, Float:Y, Float:Z, Float:Speed, Float:RotX = -1000.0, Float:RotY = -1000.0, Float:RotZ = -1000.0) objectid The ID of the object to move. Float:X The X coordinate to move the object to. Float:Y The Y coordinate to move the object to. Float:Z The Z coordinate to move the object to. Float:Speed The speed at which to move the object (units per second). Float:RotX The FINAL X rotation (optional). Float:RotY The FINAL Y rotation (optional). Float:RotZ The FINAL Z rotation (optional). Returns The time it will take for the object to move in milliseconds.
if(strcmp(cmdtext,"/opengate",true)==0 || strcmp(cmdtext,"/og",true)==0){
if (IsPlayerInRangeOfPoint(playerid,30, 2053.16, -1762.77, 14.25)){
//The player is near the gate.
MoveObject(gate,2053.16, -1762.77, 14.25,15); // Moves object "gate" to other point
}else{
//The player is not near the gate.
}
return 1;
}
if(strcmp(cmdtext,"/opengate",true)==0 || strcmp(cmdtext,"/og",true)==0){
if (IsPlayerInRangeOfPoint(playerid,30, 2053.16, -1762.77, 14.25)){
//The player is near the gate.
MoveObject(gate,2053.16, -1762.77, 14.25,15); // Moves object "gate" to other point
}else{
//The player is not near the gate.
SendClientMessage(playerid,RED,"You are not close enough to open the gate.");
}
return 1;
}
SendClientMessage (playerid, color, const message[]) playerid The playerid you would like to display the message for. color The color it should be in. const message[] The text you would like to display. max len displayable: 144 Returns This function doesn't return a specific value
if(strcmp(cmdtext,"/closegate",true)==0 || strcmp(cmdtext,"/cg",true)==0){
}
if(strcmp(cmdtext,"/closegate",true)==0 || strcmp(cmdtext,"/cg",true)==0){
if (IsPlayerInRangeOfPoint(playerid,30,2053.16, -1762.77, 14.25)){
//The player is near the gate.
}else{
//The player is not near the gate.
}
}
if(strcmp(cmdtext,"/closegate",true)==0 || strcmp(cmdtext,"/cg",true)==0){
if (IsPlayerInRangeOfPoint(playerid,30,2053.16, -1762.77, 14.25)){
//The player is near the gate.
MoveObject(gate,2053.16, -1762.77, 14.25,15);
}else{
//The player is not near the gate.
SendClientMessage(playerid,RED,"You are not close enough to open the gate.");
}
}