i need that cmd pls!
#1

how i make a tele cmd for admins just exm: /adminsh i want players can't use this cmd just admins.
can any one make it or help me make it ?
Reply
#2

Add this to the top of your command:
Код:
if(!IsPlayerAdmin(playerid)) return 0;
It will display the SERVER: Unknown command. message.
Reply
#3

Код:
CMD:adminsh(playerid, params[])
      if(IsPlayerAdmin(id))
this if u want player who write the cmd be admin

Код:
CMD:adminsh(playerid, params[])
if(PlayerInfo[playerid][Level] >= 5
this if u want only admins+5 to use this cmd
Reply
#4

Thank you FrAnKiN1 and Freaksken
Reply
#5

like this ?>>
Код:
CMD:adminsh(playerid,params[]) {
        if(PlayerInfo[playerid][Level] >= 6) 
	if(PlayerInfo[playerid][Jailed] == 1) return SendMessageToPlayer(playerid,COLOR_BRIGHTRED,"You cannot escape your punishment!");
	TeleTimer[playerid] = SetTimerEx("ttimer", 1000, true, "i",playerid);
	tseconds[playerid] = 6;
	vCount[playerid] = 1;
	Tx[playerid] = 264.8170;
	Ty[playerid] = 2799.3894;
	Tz[playerid] = 30.4917;
	Ti[playerid] = 0;
	ResetPlayerWeapons(playerid);
	SetPlayerHealth(playerid,100);
	GivePlayerWeapon(playerid,30,2000);
	GivePlayerWeapon(playerid,29,2000);
	new string[128];
	new bdname[MAX_PLAYER_NAME];
	format(telestring,43,"~w~] admins houses]");
	GetPlayerName(playerid, bdname, sizeof(bdname));
	format(string, sizeof(string), "[TELE]:%s Has Just Teleported To  admin houses /adminsh", bdname);
    SendClientMessageToAll(lightblue, string);
	return 1;
}
i think it's wrong i want players can't tele to it and when try send message to palyer :you must be admin to use this command
Reply
#6

help pls!
Reply
#7

What do you want:
  • Only admins can teleport and when a normal player tries it will not let him and give him a message?
  • Anything else
Reply
#8

here is the command

PHP код:
COMMAND:teleport(playeridparams[])
{
    if(
playerData[playerid][playerLoggedIn])
    {
        if(!
IsPlayerAdmin(playerid)) 
        {
          
ShowPlayerDialog(playeridDIALOG_ATELEPORTDIALOG_STYLE_LIST"Admin Teleport""Bank \nSFPD \nSFPD Parking Lot \nArmy Spawn \nCIA/FBI Spawn \nAmmunation \nAirport \nHospital \nSupa Save \nChurch \nSuburban \nGym \nLS Airport \nVan Courier \nVIP Lounge \nCar Drop \nBomb Shop \nJob Centre \nBank Interior \nTrucking \nAdmin Lounge \nVehicle Dealership \nForklift Mission \nMinigames""Go""Cancel");
        }
        else
        {
            return 
0;
        }
    }
    else
    {
        
SendClientMessage(playeridCOLOR_WHITE"{B7B7B7}[SERVER] {FFFFFF}You must be logged in to use commands.");
    }
    return 
1;

and here is the dialog response

PHP код:
// Teleport dialog
    
if(dialogid == DIALOG_ATELEPORT)
    {
        
// If the user clicked on a teleport location
        
if(response)
        {
              switch(
listitem)
            {
                case 
0// Teleport to Bank
                 
{
                    
// -1509.1115, 920.4254, 7.1875
                    
SetPlayerPos(playerid, -1509.1115920.42547.1875);
                    
SetPlayerInterior(playerid0);
                    
SetPlayerVirtualWorld(playerid0);
                }
                 case 
1// Teleport to SFPD
                  
{
                    
// -1605.7467, 713.4993, 13.4357
                    
SetPlayerPos(playerid, -1605.7467713.499313.4357);
                    
SetPlayerInterior(playerid0);
                    
SetPlayerVirtualWorld(playerid0);
                       }
                 case 
2// Teleport to SFPD Parking Lot
                 
{
                    
// -1606.8942, 662.3884, 7.1875
                    
SetPlayerPos(playerid, -1606.8942662.38847.1875);
                    
SetPlayerInterior(playerid0);
                    
SetPlayerVirtualWorld(playerid0);
                 }
                 case 
3// Teleport to Army Spawn
                 
{
                    
// -1253.1248, 458.0851, 7.1875
                    
SetPlayerPos(playerid, -1253.1248458.08517.1875);
                    
SetPlayerInterior(playerid0);
                    
SetPlayerVirtualWorld(playerid0);
                 }
                 case 
4// Teleport to CIA/FBI Spawn
                 
{
                    
// -2442.1868, 499.2131, 30.0924
                    
SetPlayerPos(playerid, -2442.1868499.213130.0924);
                    
SetPlayerInterior(playerid0);
                    
SetPlayerVirtualWorld(playerid0);
                 }
                case 
5// Teleport to Ammunation
                
{
                    
// -2628.7629, 214.2198, 4.3952
                    
SetPlayerPos(playerid, -2628.7629214.21984.3952);
                    
SetPlayerInterior(playerid0);
                    
SetPlayerVirtualWorld(playerid0);
                }
                case 
6// Teleport to Airport
                
{
                    
// -1315.6328, -227.7303, 14.1484
                    
SetPlayerPos(playerid, -1315.6328, -227.730314.1484);
                    
SetPlayerInterior(playerid0);
                    
SetPlayerVirtualWorld(playerid0);
                }
                case 
7// Teleport to Hosital
                
{
                    
// -2647.6118, 625.6426, 14.4531
                    
SetPlayerPos(playerid, -2647.6118625.642614.4531);
                    
SetPlayerInterior(playerid0);
                    
SetPlayerVirtualWorld(playerid0);
                }
                case 
8// Teleport to Supa Save
                
{
                    
// -2442.5156, 749.2994, 35.178
                    
SetPlayerPos(playerid, -2442.5156749.299435.178);
                    
SetPlayerInterior(playerid0);
                    
SetPlayerVirtualWorld(playerid0);
                }
                case 
9// Teleport to Church
                
{
                    
// -1982.1945, 1117.7213, 53.1233
                    
SetPlayerPos(playerid, -1982.19451117.721353.1233);
                    
SetPlayerInterior(playerid0);
                    
SetPlayerVirtualWorld(playerid0);
                }
                case 
10// Teleport to Suburban
                
{
                    
// -2515.1592, -25.7249, 25.6172
                    
SetPlayerPos(playerid, -2515.1592, -25.724925.6172);
                    
SetPlayerInterior(playerid0);
                    
SetPlayerVirtualWorld(playerid0);
                }
                case 
11// Teleport to Gym
                
{
                    
// -2267.0471, -161.5091, 35.3203
                    
SetPlayerPos(playerid, -2267.0471, -161.509135.3203);
                    
SetPlayerInterior(playerid0);
                    
SetPlayerVirtualWorld(playerid0);
                }
                case 
12// Teleport to LS Airport
                
{
                    
// 1875.0139, -2612.8547, 13.5469
                    
SetPlayerPos(playerid1875.0139, -2612.854713.5469);
                    
SetPlayerInterior(playerid0);
                    
SetPlayerVirtualWorld(playerid0);
                }
                case 
13// Teleport to Van Courier Job
                
{
                    
// -2499.7781, -614.3375, 132.5625
                    
SetPlayerPos(playerid, -2499.7781, -614.3375132.5625);
                    
SetPlayerInterior(playerid0);
                    
SetPlayerVirtualWorld(playerid0);
                }
                case 
14// Teleport to VIP Lounge
                
{
                    
// -1790.8135, 572.1437, 35.1641
                    
SetPlayerPos(playerid, -1790.8135572.143735.16415);
                    
SetPlayerInterior(playerid0);
                    
SetPlayerVirtualWorld(playerid0);
                }
                case 
15// Car Drop
                
{
                    
// -1734.0756, 190.9162, 3.5547
                    
SetPlayerPos(playerid, -1734.0756190.91623.5547);
                    
SetPlayerInterior(playerid0);
                    
SetPlayerVirtualWorld(playerid0);
                }
                case 
16// Bomb Shop
                
{
                    
// -1780.5876, 1205.9221 25.1250
                    
SetPlayerPos(playerid, -1780.58761205.922125.1250);
                    
SetPlayerInterior(playerid0);
                    
SetPlayerVirtualWorld(playerid0);
                }
                case 
17// Job Centre
                
{
                    
// -1885.1152, 826.8466, 35.1728
                    
SetPlayerPos(playerid, -1885.1152826.846635.1728);
                    
SetPlayerInterior(playerid0);
                    
SetPlayerVirtualWorld(playerid0);
                }            
                case 
18// Bank Interior
                
{
                    
// 2464.00000000, 2376.80004883, -35.00000000
                    
SetPlayerPos(playerid, -467.1987,-196.4525,985.3784);
                    
SetPlayerInterior(playerid3);
                    
SetPlayerVirtualWorld(playerid32);
                }
                case 
19// Trucking
                
{
                    
SetPlayerPos(playerid, -1838.5251146.540915.1172);
                    
SetPlayerInterior(playerid0);
                    
SetPlayerVirtualWorld(playerid0);
                }
                case 
20// Admin Lounge
                
{
                    
SetPlayerPos(playerid, -2035.90371183.073945.2969);
                    
SetPlayerInterior(playerid0);
                    
SetPlayerVirtualWorld(playerid0);
                }                
                case 
21// Dealership
                
{
                    
SetPlayerPos(playerid, -1929.2322265.534241.0469);
                    
SetPlayerInterior(playerid0);
                    
SetPlayerVirtualWorld(playerid0);                
                }
                case 
22// Forklift
                
{
                    
SetPlayerPos(playerid, -1703.759890.99233.5547);
                    
SetPlayerInterior(playerid0);
                    
SetPlayerVirtualWorld(playerid0);        
                }
                case 
23// Minigames
                
{
                    
SetPlayerPos(playerid, -1551.09401168.63727.1875);
                    
SetPlayerInterior(playerid0);
                    
SetPlayerVirtualWorld(playerid0);        
                }
               }
           }
       } 
You can edit the positions to whatever you like.It's just an example.
Reply
#9

Quote:
Originally Posted by Freaksken
Посмотреть сообщение
Add this to the top of your command:
Код:
if(!IsPlayerAdmin(playerid)) return 0;
It will display the SERVER: Unknown command. message.
a question. if the player was admin (admin system) or rcon?
Reply
#10

Quote:
Originally Posted by vikoo
Посмотреть сообщение
like this ?>>
Код:
CMD:adminsh(playerid,params[]) {
        if(PlayerInfo[playerid][Level] >= 6) 
	if(PlayerInfo[playerid][Jailed] == 1) return SendMessageToPlayer(playerid,COLOR_BRIGHTRED,"You cannot escape your punishment!");
	TeleTimer[playerid] = SetTimerEx("ttimer", 1000, true, "i",playerid);
	tseconds[playerid] = 6;
	vCount[playerid] = 1;
	Tx[playerid] = 264.8170;
	Ty[playerid] = 2799.3894;
	Tz[playerid] = 30.4917;
	Ti[playerid] = 0;
	ResetPlayerWeapons(playerid);
	SetPlayerHealth(playerid,100);
	GivePlayerWeapon(playerid,30,2000);
	GivePlayerWeapon(playerid,29,2000);
	new string[128];
	new bdname[MAX_PLAYER_NAME];
	format(telestring,43,"~w~] admins houses]");
	GetPlayerName(playerid, bdname, sizeof(bdname));
	format(string, sizeof(string), "[TELE]:%s Has Just Teleported To  admin houses /adminsh", bdname);
    SendClientMessageToAll(lightblue, string);
	return 1;
}
i think it's wrong i want players can't tele to it and when try send message to palyer :you must be admin to use this command
This is Right One
Код:
CMD:adminsh(playerid,params[]) {
        if(PlayerInfo[playerid][Level] < 6)  return SendClientMessage(playerid,0xFF0000FF,"ERROR: You're Not High Enough level to Use This Command");
	if(PlayerInfo[playerid][Jailed] == 1) return SendMessageToPlayer(playerid,COLOR_BRIGHTRED,"You cannot escape your punishment!");
	TeleTimer[playerid] = SetTimerEx("ttimer", 1000, true, "i",playerid);
	tseconds[playerid] = 6;
	vCount[playerid] = 1;
	Tx[playerid] = 264.8170;
	Ty[playerid] = 2799.3894;
	Tz[playerid] = 30.4917;
	Ti[playerid] = 0;
	ResetPlayerWeapons(playerid);
	SetPlayerHealth(playerid,100);
	GivePlayerWeapon(playerid,30,2000);
	GivePlayerWeapon(playerid,29,2000);
	new string[128];
	new bdname[MAX_PLAYER_NAME];
	format(telestring,43,"~w~] admins houses]");
	GetPlayerName(playerid, bdname, sizeof(bdname));
	format(string, sizeof(string), "[TELE]:%s Has Just Teleported To  admin houses /adminsh", bdname);
    SendClientMessageToAll(lightblue, string);
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)