[Question] Is there a way to check... - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Question] Is there a way to check... (
/showthread.php?tid=68581)
[Question] Is there a way to check... -
Castle - 11.03.2009
Is there a way to check if a Player have a certain name to use a Command?
pawn Код:
if (strcmp("/cctv", cmdtext, true) == 0)
{
PlayerMenu[playerid] = 0;
TogglePlayerControllable(playerid, 0);
ShowMenuForPlayer(CCTVMenu[0], playerid);
return 1;
}
Please help..
Re: [Question] Is there a way to check... -
Dujma - 11.03.2009
You mean like GetPlayerName?
Re: [Question] Is there a way to check... -
GTA_Rules - 11.03.2009
Quote:
new Data[MAX_PLAYER_NAME];
GetPlayerName(playerid, Data, sizeof(Data));
if(strcmp(Data,"yournamehere",true))
|
Quote:
if (strcmp("/cctv", cmdtext, true) == 0)
{
new Data[MAX_PLAYER_NAME];
GetPlayerName(playerid, Data, sizeof(Data));
if(strcmp(Data,"yournamehere",true))[/
{
PlayerMenu[playerid] = 0;
TogglePlayerControllable(playerid, 0);
ShowMenuForPlayer(CCTVMenu[0], playerid);
return 1;
}
}
|
Untested* and I'm a newbie aswell, so don't flame me.
Re: [Question] Is there a way to check... -
MenaceX^ - 11.03.2009
pawn Код:
new n[24];
GetPlayerName(playerid, n, 24);
if (strcmp("/cctv", cmdtext, true) == 0)
{
if(strcmp(n, "YourName", true) != 0)
return SendClientMessage(playerid,0xFF6347AA, " You shouldn't use this command with your name."); PlayerMenu[playerid] = 0;
TogglePlayerControllable(playerid, 0);
ShowMenuForPlayer(CCTVMenu[0], playerid);
return 1;
}
Re: [Question] Is there a way to check... -
Dujma - 11.03.2009
Quote:
Originally Posted by MenaceX^
pawn Код:
new n[24]; GetPlayerName(playerid, n, 24); if (strcmp("/cctv", cmdtext, true) == 0) { if(strcmp(pname, "YourName", true) != 0) return SendClientMessage(playerid,0xFF6347AA, " You shouldn't use this command with your name."); PlayerMenu[playerid] = 0; TogglePlayerControllable(playerid, 0); ShowMenuForPlayer(CCTVMenu[0], playerid); return 1; }
|
pname?
Re: [Question] Is there a way to check... -
MenaceX^ - 11.03.2009
oh ops :S. I allways use pname, this time I used n instead.
Re: [Question] Is there a way to check... -
Dujma - 11.03.2009
Quote:
Originally Posted by MenaceX^
oh ops :S. I allways use pname, this time I used n instead.
|
hehe
Sparow use wiki more you will find there everything that you need. On every function and callback you have an explanation and usage example. You will learn better on your own and you will understand it better.
Re: [Question] Is there a way to check... -
GTA_Rules - 11.03.2009
Would my code work? (Just wondering :P)
Re: [Question] Is there a way to check... -
Dujma - 11.03.2009
Quote:
Originally Posted by GTA_Rules
Would my code work? (Just wondering :P)
|
Test it :P
Re: [Question] Is there a way to check... -
MenaceX^ - 11.03.2009
Quote:
Originally Posted by GTA_Rules
Would my code work? (Just wondering :P)
|
If you don't sure about your code, you better keep them away. It's confused people that learn from it.