Small question about a command
#1

Hello,

How can I make a command that only if you are named "dirkblok" you can do the command?

So the player needs to have the playername dirkblok to use the command...

thanks alot guys

Dirk
Reply
#2

Quote:
Originally Posted by dirkblok
Hello,

How can I make a command that only if you are named "dirkblok" you can do the command?

So the player needs to have the playername dirkblok to use the command...

thanks alot guys

Dirk
how about reading the wiki? -_-

https://sampwiki.blast.hk/wiki/Using_strcmp%28%29
https://sampwiki.blast.hk/wiki/GetPlayerName
juz compare if it is "dirkblok"
Reply
#3

Thanks but... Can you explain this for me?

So I need to create a GetPlayerName(playerid, name, sizeof(name));

and then :

if GetPlayerName(playerid, name,sizeof(name)) == dirkblok
{
// everything
}
else
{
SendClientMessage(playerid, COLOR, "you are not dirkblok");
}

am I right?

Thanks
Reply
#4

pawn Код:
new name[24];
GetPlayerName(playerid, name, sizeof(name));//Get the name here.
if(strcmp(name, "dirkblok", true) == 0)//Match name with dirkblok
{
  //do something
}
else
{
  SendClientMessage(playerid, COLOR, "You're not dirkblok!");
}
Reply
#5

you can do:

Код:
if (GetPlayerName(playerid) == dirkblok)
{
 //You cmd
}
else
{
 SendClientMessage(playerid, 0xFFFF00FF,"You are not dirkblok!");
}
Should work, post here if any errors...
Reply
#6

No Tigerbeast11, you can't use GetPlayerName like that.
https://sampwiki.blast.hk/wiki/GetPlayerName
Reply
#7

Thanks alot guys
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)