Help Make Commands For Player Name - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help Make Commands For Player Name (
/showthread.php?tid=503027)
Help Make Commands For Player Name -
donhu789 - 27.03.2014
How can i make commands for 2 players name because i need a commands that for me and mine friend =.=
Re: Help Make Commands For Player Name -
Diogo123 - 27.03.2014
An example
pawn Код:
if (strcmp(cmdtext, "/mycommand", true) == 0)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
if(!strcmp(pname, "YOUR NICK"))
{
SendClientMessage(playerid, -1, "OWNED");
}
else
{
SendClientMessage(playerid, -1, "NOT OWNED!");
}
return 1;
}
Re: Help Make Commands For Player Name -
donhu789 - 27.03.2014
wait wut ?
Re: Help Make Commands For Player Name -
Diogo123 - 27.03.2014
if(!strcmp(pname, "YOUR NICK")) put your nick and the command will only work for you ...
Re: Help Make Commands For Player Name -
donhu789 - 27.03.2014
i need for 2 player :\
i should do Else if for another guys ?
Re: Help Make Commands For Player Name -
Diogo123 - 27.03.2014
So try
pawn Код:
if (strcmp(pname,"NICK",true)==0 || strcmp(pname,"NICK2",true)==0)
sorry for the inconvenience ^^
Re: Help Make Commands For Player Name -
Hanuman - 27.03.2014
pawn Код:
if (strcmp(cmdtext, "/yourcommand", true) == 0)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
if(strcmp(sendername,"Your_name",true)==0 || strcmp(sendername,"Friends_name",true)==0)
{
//your_code
}
else{
SendClientMessage(playerid, -1, "Server: Unknown Command");
}
return 1;
}
Re: Help Make Commands For Player Name -
donhu789 - 27.03.2014
okay =)
Re: Help Make Commands For Player Name -
donhu789 - 27.03.2014
283.91,-1146.53,80.91
my place of Armoury how can i add the Place player must be in this 283.91,-1146.53,80.91 to use the commands ?
Re: Help Make Commands For Player Name -
Hanuman - 27.03.2014
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 5.0, 283.91, -1146.53, 80.91)) //here 5.0 is the range of the point in which he can use the cmd
{
// do this this and this
}