Command for a specific name
#1

As the topic says how do i make a specific command for a specific name?
Reply
#2

Can you explain more so i can help you, thanks.
Reply
#3

Just check if the command is executed by that specific player
What command processor do you use / what command do you want to have converted?
Reply
#4

Get players name (https://sampwiki.blast.hk/wiki/GetPlayerName) to a variable, and check if variable is same as the specified name.
If not, return 0 or error message.
Reply
#5

how can i make this command for a specified name instead of level?

pawn Код:
CMD:fix(playerid,params[])
{
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 1) {
        if (IsPlayerInAnyVehicle(playerid)) {
            RepairVehicle(GetPlayerVehicleID(playerid));
            SetVehicleHealth(GetPlayerVehicleID(playerid),1250.0);
            return SendClientMessage(playerid,blue,"Vehicle Fixed");
        } else return SendClientMessage(playerid,red,"Error: You are not in a vehicle");
    } else return SendClientMessage(playerid,red,"ERROR: You need to be level 1 to use this command");
}
Reply
#6

https://sampwiki.blast.hk/wiki/Strcmp
https://sampwiki.blast.hk/wiki/GetPlayerName
Reply
#7

need an example code
Reply
#8

Read those two wikis. It's not that hard.
Reply
#9

Код:
CMD:fix(playerid,params[])
{
	#pragma unused params
        new name[32];
        GetPlayerName(playerid, name,32);
	if(!strcmp(name, "name here", false) {
		if (IsPlayerInAnyVehicle(playerid)) {
			RepairVehicle(GetPlayerVehicleID(playerid));
			SetVehicleHealth(GetPlayerVehicleID(playerid),1250.0);
			return SendClientMessage(playerid,blue,"Vehicle Fixed");
		} else return SendClientMessage(playerid,red,"Error: You are not in a vehicle");
	} else return SendClientMessage(playerid,red,"ERROR: You need to be level 1 to use this command");
}
Reply
#10

Quote:
Originally Posted by CrazyChoco
Посмотреть сообщение
Read those two wikis. It's not that hard.
And this post is really really helpful!

Btw thank you Tamp and IzadorO
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)