19.05.2012, 12:24
ℓмяαη_кнαη Present :
Hi all this is " ℓмяαη_кнαη " showing you on how to create some simple commands using acmd .Which is mostly used for stunting server.Hope you'll like it !!!!
1 : you'll need to download <zcmd> ****** it and then define this / add this at top of your scriptHi all this is " ℓмяαη_кнαη " showing you on how to create some simple commands using acmd .Which is mostly used for stunting server.Hope you'll like it !!!!
pawn Code:
#include <zcmd>
- OOK We will create the command
pawn Code:
CMD:get(playerid, params[]) // commands /get to get player to your position
- Now cmd is created now we wiull define that IsPlayerAdmin . Mean only administrator's of server can use this command !!!!
pawn Code:
{
if (P_DATA[ playerid ][ P_Level ] < 3)return SendError( playerid, "You are not allowed to use this command"),SendReason( playerid, " Low level!"); // if player is admin .. You can change the max admin level < 3
- Now We will tell the system to not to allowed the %s player if he was not logined !!!
pawn Code:
if (P_DATA[ playerid ][ P_Logged ] == 0)return SendError( playerid, "Please login to use this command!"); // This [P_logged ] == 0 ) 0 means that player was not login
- Now to send the Specific player the correct usege of commands !!!!
pawn Code:
if ( sscanf( params, "u", params[ 0 ]) )return SendUsage( playerid, "/gethere <id>" ); // Showing the usage usage and using sscanf for this
- To use the correct mean is the player connected >? We'll use
pawn Code:
if ( !IsPlayerConnected( params[ 0 ] ) )return SendError( playerid, "Player is not connected!"); // invalid player
- If the player was not enoughed leveled mean he was not administrator . we will use !!!
pawn Code:
if (P_DATA[ params[ 0 ] ][ P_Level ] > P_DATA[ playerid ][ P_Level ])return SendError( playerid, "You have no rights to use admin commands on higher admins!"); // change the admin elvel for up
- Now we will use this function paramsX to get the %s and %s position :
pawn Code:
new Float:ParamX, Float:ParamY, Float:ParamZ, Float:ParamVX, Float:ParamVY, Float:ParamVZ;
- Remember : we will use " IsPlayerInAnyVehicle " which used for if a player is in any cars .This system wont get the %s player
pawn Code:
if (IsPlayerInAnyVehicle( params[ 0 ] ) ) // if a player is on car the command wont work. Remove to remove this system
pawn Code:
{
SetCameraBehindPlayer( params[ 0 ] ); // player will spawn behind the %s who get the %s player
GetVehiclePos( GetPlayerVehicleID( playerid ), ParamVX, ParamVY, ParamVZ ); // get the %s who is going to be get
SetVehiclePos( GetPlayerVehicleID( params[ 0 ] ), ParamVX+2, ParamVY+2, ParamVZ ); // to the person position who is getting
LinkVehicleToInterior( GetPlayerVehicleID( params[ 0 ] ), GetPlayerInterior( playerid ));
}
else
{
SetCameraBehindPlayer( params[ 0 ] );
GetPlayerPos( playerid, ParamX, ParamY, ParamZ );
SetPlayerPos( params[ 0 ], ParamX+2, ParamY+2, ParamZ );
SetPlayerInterior( params[ 0 ], GetPlayerInterior( playerid ));
}
FormMessageForAllEx(playerid,COLOR_GREEN, "Administrator %s teleported %s to his location!",PlayerName2( playerid ), PlayerName2( params[ 0 ] )); // send a message to all
FormMessage( params[ 0 ], COLOR_GREEN, "Administrator %s teleported you to his position!",PlayerName2( playerid )); // send message to the player who has been getted
FormMessage( playerid, COLOR_GREEN, "You teleported %s to your location!",PlayerName2( params[ 0 ] )); // easy to understand this one !!!!
return 1;
} // No need to define this thing becouse its too easy and understandable
- Again to create the command to getall player in your position:
pawn Code:
CMD:getall(playerid, params[])
- Again the same to not to allow the player to use this command if he is not enought leveld .So we will use
pawn Code:
if (P_DATA[ playerid ][ P_Level ] < 4)return SendError( playerid, "You are not allowed to use this command"),SendReason( playerid, " Low level!");
- We will use this if a player is not login .%s player whos is trying to use this command
pawn Code:
if (P_DATA[ playerid ][ P_Logged ] == 0)return SendError( playerid, "Please login to use this command!");
if ( sscanf( params, "s", params[ 0 ]) )return SendUsage( playerid, "/getallhere <yes>" );
- To get all player position and gather them
pawn Code:
new Float:ParamX, Float:ParamY, Float:ParamZ, Float:ParamVX, Float:ParamVY, Float:ParamVZ;
- Once the player is logined and admin levled so we will make it
pawn Code:
if (strcmp( params, "yes",true) == 0)
{
FormMessageForAllEx(playerid,COLOR_RED, "Administrator %s has teleported everyone to his position!",PlayerName2( playerid )); // again to all
SendClientMessage(playerid,COLOR_GREEN, "You have teleported everyone to your position everyone!");
new string[256];
GetPlayerPos( playerid,Float:ParamX, Float:ParamY, Float:ParamZ);
GetVehiclePos( GetPlayerVehicleID( playerid ), ParamVX, ParamVY, ParamVZ );
foreach(Player, x){
if(P_DATA[ x ][ P_Level ] < 4 ){ // you can change the max admin level 3
if( x != playerid ){
if (IsPlayerInAnyVehicle( x ) )
{
SetCameraBehindPlayer( x );
SetVehiclePos( GetPlayerVehicleID( x ), ParamVX+2, ParamVY+2, ParamVZ );
LinkVehicleToInterior( GetPlayerVehicleID( x ), GetPlayerInterior( playerid ));
}
else
{
SetCameraBehindPlayer( x );
SetPlayerPos( x, ParamX+2, ParamY+2, ParamZ );
SetPlayerInterior( x, GetPlayerInterior( playerid ));
}
format(string, sizeof( string ), "Administrator %s teleported everyone to his position!",PlayerName2( playerid ));
SendClientMessage(x, COLOR_GREEN, string);
}
}
}
}
else SendUsage( playerid, "/getall <yes>" );
return 1;
}
pawn Code:
CMD:get(playerid, params[]) // commands /get to get player to your position
{
if (P_DATA[ playerid ][ P_Level ] < 3)return SendError( playerid, "You are not allowed to use this command"),SendReason( playerid, " Low level!"); // if player is admin .. and the level define here
if (P_DATA[ playerid ][ P_Logged ] == 0)return SendError( playerid, "Please login to use this command!"); // Player is admin but not login ...
if ( sscanf( params, "u", params[ 0 ]) )return SendUsage( playerid, "/gethere <id>" ); // usage and using sscanf for this
if ( !IsPlayerConnected( params[ 0 ] ) )return SendError( playerid, "Player is not connected!"); // invalid player
if (P_DATA[ params[ 0 ] ][ P_Level ] > P_DATA[ playerid ][ P_Level ])return SendError( playerid, "You have no rights to use admin commands on higher admins!");
new Float:ParamX, Float:ParamY, Float:ParamZ, Float:ParamVX, Float:ParamVY, Float:ParamVZ;
if (IsPlayerInAnyVehicle( params[ 0 ] ) ) // if a player is on car the command wont work. Remove to remove this system
{
SetCameraBehindPlayer( params[ 0 ] ); // player will spawn behind the %s who get the %s player
GetVehiclePos( GetPlayerVehicleID( playerid ), ParamVX, ParamVY, ParamVZ ); // get the %s who is going to be get
SetVehiclePos( GetPlayerVehicleID( params[ 0 ] ), ParamVX+2, ParamVY+2, ParamVZ ); // to the person position who is getting
LinkVehicleToInterior( GetPlayerVehicleID( params[ 0 ] ), GetPlayerInterior( playerid ));
}
else
{
SetCameraBehindPlayer( params[ 0 ] );
GetPlayerPos( playerid, ParamX, ParamY, ParamZ );
SetPlayerPos( params[ 0 ], ParamX+2, ParamY+2, ParamZ );
SetPlayerInterior( params[ 0 ], GetPlayerInterior( playerid ));
}
FormMessageForAllEx(playerid,COLOR_GREEN, "Administrator %s teleported %s to his location!",PlayerName2( playerid ), PlayerName2( params[ 0 ] ));
FormMessage( params[ 0 ], COLOR_GREEN, "Administrator %s teleported you to his position!",PlayerName2( playerid ));
FormMessage( playerid, COLOR_GREEN, "You teleported %s to your location!",PlayerName2( params[ 0 ] )); // easy to understand this one !!!!
return 1;
}
CMD:getall(playerid, params[])
{
if (P_DATA[ playerid ][ P_Level ] < 4)return SendError( playerid, "You are not allowed to use this command"),SendReason( playerid, " Low level!");
if (P_DATA[ playerid ][ P_Logged ] == 0)return SendError( playerid, "Please login to use this command!");
if ( sscanf( params, "s", params[ 0 ]) )return SendUsage( playerid, "/getallhere <yes>" );
new Float:ParamX, Float:ParamY, Float:ParamZ, Float:ParamVX, Float:ParamVY, Float:ParamVZ;
if (strcmp( params, "yes",true) == 0)
{
FormMessageForAllEx(playerid,COLOR_RED, "Administrator %s has teleported everyone to his position!",PlayerName2( playerid ));
SendClientMessage(playerid,COLOR_GREEN, "You have teleported everyone to your position everyone!");
new string[256];
GetPlayerPos( playerid,Float:ParamX, Float:ParamY, Float:ParamZ);
GetVehiclePos( GetPlayerVehicleID( playerid ), ParamVX, ParamVY, ParamVZ );
foreach(Player, x){
if(P_DATA[ x ][ P_Level ] < 4 ){
if( x != playerid ){
if (IsPlayerInAnyVehicle( x ) )
{
SetCameraBehindPlayer( x );
SetVehiclePos( GetPlayerVehicleID( x ), ParamVX+2, ParamVY+2, ParamVZ );
LinkVehicleToInterior( GetPlayerVehicleID( x ), GetPlayerInterior( playerid ));
}
else
{
SetCameraBehindPlayer( x );
SetPlayerPos( x, ParamX+2, ParamY+2, ParamZ );
SetPlayerInterior( x, GetPlayerInterior( playerid ));
}
format(string, sizeof( string ), "Administrator %s teleported everyone to his position!",PlayerName2( playerid ));
SendClientMessage(x, COLOR_GREEN, string);
}
}
}
}
else SendUsage( playerid, "/getall <yes>" );
return 1;
}