#include <zcmd>
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 .. You can change the max admin level < 3
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
if ( sscanf( params, "u", params[ 0 ]) )return SendUsage( playerid, "/gethere <id>" ); // Showing the usage 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!"); // change the admin elvel for up
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 ] )); // 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
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 )); // 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;
}
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;
}
if (P_DATA[ playerid ][ P_Level ] < 3)return SendError( playerid, "You are not allowed to use this command"),SendReason( playerid, " Low level!");
You need to explain everything in your tutorial!
pawn Code:
|
pawn Code:
|