// in your command
new Name[32];
GetPlayerName(playerid, Name, sizeof(Name));
if(!strcmp(Name, "YourNameThere", true)) // Check if player name it's 'YourNameThere' - The name can be too 'YOURnameTHere' ...
{
// Rest of the command there
}
else return SendClientMessage(playerid, -1, "Only 'YourNameThere' can use that command.");
|
Код:
// in your command
new Name[32];
GetPlayerName(playerid, Name, sizeof(Name));
if(!strcmp(Name, "YourNameThere", true)) // Check if player name it's 'YourNameThere' - The name can be too 'YOURnameTHere' ...
{
// Rest of the command there
}
else return SendClientMessage(playerid, -1, "Only 'YourNameThere' can use that command.");
|
#include a_samp
#include zcmd
CMD:jetpack(playerid,params[]) {
new Name[32];
GetPlayerName(playerid, Name, sizeof(Name));
if(!strcmp(Name, "DOG", true)) {
SendClientMessage(playerid,-1,"|- Jetpack Spawned! -|");
return SetPlayerSpecialAction(playerid, 2);
} else return SendClientMessage(playerid,-1,"ERROR: You need to be Dog to use this command XD");
}
if(!strcmp(cmdtext[6], "/help", true))
{
if(!strcmp(Name, "YourNameThere", true)) // Check if player name it's 'YourNameThere' - The name can be too 'YOURnameTHere' ...
{
SendClientMessage(playerid, -1, "You are the right user.");
}
else return SendClientMessage(playerid, -1, "Only 'YourNameThere' can use that command.");
}
|
Depends on what command proccesor you use .. If you use that OnPlayerCommand for commands , yeah ..
Код HTML:
if(!strcmp(cmdtext[6], "/help", true))
{
if(!strcmp(Name, "YourNameThere", true)) // Check if player name it's 'YourNameThere' - The name can be too 'YOURnameTHere' ...
{
SendClientMessage(playerid, -1, "You are the right user.");
}
else return SendClientMessage(playerid, -1, "Only 'YourNameThere' can use that command.");
}
|
new user[32];
GetPlayerName(playerid, user, sizeof(user));
if(!strcmp(user, "YourNameThere", true)) // Check if player name it's 'YourNameThere' - The name can be too 'YOURnameTHere' ...
{
SendClientMessage(playerid, -1, "You are the right user.");
}
else return SendClientMessage(playerid, -1, "Only 'YourNameThere' can use that command.");
}