Scripting question
#1

Hey guys can someone tell me how do I make a script that reserves a cmd to a specific person (the owner for example) ? Because I have this /setlevel cmd that I want only me to be able to use and I dont want the other rcon admins to be able to use it. Is there a way to make a script which allows only my username or my ip to use that command ?
Reply
#2

Код:
// 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.");
Reply
#3

Quote:
Originally Posted by Mariciuc223
Посмотреть сообщение
Код:
// 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.");
So I put this in the OnPlayerCommand ?
Reply
#4

dude o.o
PHP код:
#include a_samp
#include zcmd


CMD:jetpack(playerid,params[]) {
    new 
Name[32];
    
GetPlayerName(playeridNamesizeof(Name));
    if(!
strcmp(Name"DOG"true)) {
    
SendClientMessage(playerid,-1,"|- Jetpack Spawned! -|");
    return 
SetPlayerSpecialAction(playerid2);
    } else return 
SendClientMessage(playerid,-1,"ERROR: You need to be Dog to use this command XD");

Reply
#5

Quote:
Originally Posted by brandypol
Посмотреть сообщение
So I put this in the OnPlayerCommand ?
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.");
}
Reply
#6

Quote:
Originally Posted by Mariciuc223
Посмотреть сообщение
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.");
}
Thanks but now the compiler says that I have to define the symbol "Name"
Reply
#7

PHP код:
new user[32];
    
GetPlayerName(playeridusersizeof(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.");

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)