06.11.2011, 00:24
i have problem to make admin command.....
please tell me how
please tell me how
if(!strcmp (cmdtext, "/get", true, 4))
{
if(IsPlayerAdmin(playerid))
{
if(!strlen(cmdtext)) return SendClientMessage(playerid, -1, "USAGE: /get [playerid]");
new player1, string[128], pname[24],aname[24];
GetPlayerName(playerid,aname,24); // admin name
GetPlayerName(player1,pname,24); // target name
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);
SetPlayerInterior(player1,GetPlayerInterior(playerid));
SetPlayerVirtualWorld(player1,GetPlayerVirtualWorld(playerid));
if(GetPlayerState(player1) == 2) // if in a car
{
new VehicleID = GetPlayerVehicleID(player1);
SetVehiclePos(VehicleID,x+3,y,z); LinkVehicleToInterior(VehicleID,GetPlayerInterior(playerid));
SetVehicleVirtualWorld(GetPlayerVehicleID(player1),GetPlayerVirtualWorld(playerid));
}
else
{
SetPlayerPos(player1,x+2,y,z);
}
format(string,sizeof(string),"Teleported To Administrator %s (%d)'s Location.",aname,playerid);
SendClientMessage(player1,-1,string);
format(string,sizeof(string),"Teleported To %s (%d)'s Location", pname,player1);
SendClientMessage(playerid,-1,string);
} else return SendClientMessage(playerid, -1, "Invalid Player ID Or Is Yourself.");
} else return SendClientMessage(playerid,-1,"Invalid Command. Type /help For A List Of Help Topics."); // will say invalid command so players don't know the cmd
}
CMD:get(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 2)
{
new targetid, string[128];
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /get <playerid/name>");
if(IsPlayerConnected(targetid) && targetid != INVALID_PLAYER_ID && targetid != playerid)
{
new AdminName[24];
new pName[24];
GetPlayerName(playerid,AdminName,128);
GetPlayerName(targetid,pName,128);
format(string, sizeof(string), "You have been teleported to Administrator %s",AdminName);
SendClientMessage(targetid,COLOR_BLUE,string);
format(string, sizeof(string), "%s has been teleport to you",pName);
SendClientMessage(playerid,COLOR_GREEN,string);
SetPlayerInterior(targetid,GetPlayerInterior(playerid));
new Float:TPX, Float:TPY, Float:TPZ;
GetPlayerPos(playerid, TPX, TPY, TPZ);
SetPlayerPos(targetid, TPX, TPY, TPZ+1);
}
else return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected or its yourself.");
}
else return SendClientMessage(playerid,COLOR_RED, "ERROR: You must be Administrator Level 2 to use this command");
return 1;
}
CMD:get(playerid, params[])
{
if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, red, "{FF0000}ERROR:{FFFFFF} Invalid Command, {FF0000}[/HELP] {FFFFFF}or {FF0000}[/CMDS].");
{
new Float:x, Float:y, Float:z, ID, string[128];
if(sscanf(params, "u", ID)) return SendClientMessage( playerid, white, "USAGE: /get [playerid/partofname]");
{
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,red,"That player is not connected.");
if(ID == playerid) return SendClientMessage(playerid,red,"You cannot get yourself.");
if(GetPlayerState(ID) == PLAYER_STATE_DRIVER)
{
new veh = GetPlayerVehicleID(ID);
SetPlayerVirtualWorld(ID, GetPlayerVirtualWorld(playerid));
SetPlayerInterior(ID, GetPlayerInterior(playerid));
GetPlayerPos(playerid,x,y,z);
SetVehiclePos(veh,x,y+1,z);
PutPlayerInVehicle(ID, veh, 0);
}
else
{
SetPlayerVirtualWorld(ID, GetPlayerVirtualWorld(playerid));
SetPlayerInterior(ID, GetPlayerInterior(playerid));
GetPlayerPos(playerid,x,y,z);
SetPlayerPos(ID,x,y+1,z);
}
GetPlayerName(playerid, pname, sizeof(pname));
format(string,sizeof(string),"You have been teleported to {FF0000}%s", pname);
SendClientMessage(ID, white, string);
GetPlayerName(ID, pname, sizeof(pname));
format(string,sizeof(string),"%s{FFFFFF} has been teleported to you.", pname);
SendClientMessage(playerid, red, string);
}
}
return 1;
}