RCON only
#1

Heyy guys i have problem with some command. IDK how can i set them only for RCON.Look at this one.
Код:
// Repairs the player's vehicle
COMMAND:repair(playerid, params[])
{
	// Send the command to all admins so they can see it
	SendAdminText(playerid, "/repair", params);

	// Check if the player has logged in
	if (APlayerData[playerid][LoggedIn] == true)
	{
		// Check if the player's admin-level is at least 1
		if (APlayerData[playerid][PlayerLevel] >= 1) 
		{
		    // Check if the player is inside a vehicle
			if(!IsPlayerInAnyVehicle(playerid))
				return SendClientMessage(playerid, 0xFF0000FF, "You are not in a vehicle!"); // Let the player know he's not inside a vehicle and let the server know that this was a valid command
			// Fully repair the vehicle (damage value and bodywork)
			RepairVehicle(GetPlayerVehicleID(playerid));
			// Send the player a message to inform him that his vehicle has been repaired
			SendClientMessage(playerid, 0x00FF00FF, "Your vehicle has been successfully repaired!");
		}
		else
		    return 0;
	}
	else
	    return 0;

	// Let the server know that this was a valid command
	return 1;
}
How can I change it that only RCON can use it
Reply
#2

pawn Код:
COMMAND:repair(playerid, params[])
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not logged in as RCON ADMIN!");
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a vehicle!");
        RepairVehicle(GetPlayerVehicleID(playerid));
        SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been successfully repaired!");
        return 1;
    }
You should use IsPlayerAdmin to make it only for RCON admin. Use the above code which I made, check if it works, was a fast one anyway :P

-FalconX
Reply
#3

Okk TY !!!!!!!!
Testing.....
Reply
#4

Quote:
Originally Posted by rpx
Посмотреть сообщение
Okk TY !!!!!!!!
Testing.....
That will work for sure! Thanks to FalconX.
Reply
#5

This is something I have wanted to learn, How to do this?
Reply
#6

Quote:
Originally Posted by Ballu Miaa
Посмотреть сообщение
That will work for sure! Thanks to FalconX.
You are all welcome my friends, just trying to help everyone here.

Quote:
Originally Posted by Vasu99
Посмотреть сообщение
This is something I have wanted to learn, How to do this?
You check the script I wrote above, it will work. If you want explanation then say it down I will repeat for you.

-FalconX
Reply
#7

I am big noob bcz it wont work.
Plss edit my post so i can just copy it.
TNX !!!
Reply
#8

Quote:
Originally Posted by rpx
Посмотреть сообщение
I am big noob bcz it wont work.
Plss edit my post so i can just copy it.
TNX !!!
Why not?

Just highlight the code and copy it, then go to your gamemode, paste it, then compile it, done! you now restart your server and enjoy the repair command.

We can not edit your post because we are not an admin/moderator of this forum

-FalconX
Reply
#9

Quote:
Originally Posted by ue_falconx
Посмотреть сообщение
You check the script I wrote above, it will work. If you want explanation then say it down I will repeat for you.

-FalconX
No no, I mean. I cant come here and ask you everytime i want to know how to do this, So could you teach me?
Reply
#10

Quote:
Originally Posted by Vasu99
Посмотреть сообщение
No no, I mean. I cant come here and ask you everytime i want to know how to do this, So could you teach me?
Sure, It's not that hard. You want to know how to make such commands right? I will help you with each line.

pawn Код:
COMMAND:repair(playerid, params[])
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not logged in as RCON ADMIN!");
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a vehicle!");
        RepairVehicle(GetPlayerVehicleID(playerid));
        SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been successfully repaired!");
        return 1;
    }
In this command you will see

pawn Код:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not logged in as RCON ADMIN!");
This means that if player is NOT an admin "!" sign shows NO, so If the playerid is not an Admin he will get the message that he is not an Admin or not logged in as an Admin.

pawn Код:
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a vehicle!");
Here, it means if the player is NOT in the car he will get the message saying that he is not in any vehicle.

pawn Код:
RepairVehicle(GetPlayerVehicleID(playerid));
 SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been successfully repaired!");
"ReparVehicle", it repairs the vehicle, and the vehicle is THE same VEHICLE in which a player is sitting, GetPlayerVehicleID is used to get the vehicle id to repair it. SendClientMessage always send the message to the player.

I Hope it helps you, if you have any question you can ask me.

-FalconX
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)