Help please - 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 please (
/showthread.php?tid=531142)
Help please -
aCloudy - 11.08.2014
Hello everyone.
I made this command :
Код HTML:
if(strcmp("/tower",cmdtext,true) == 0)
{
if(IsPlayerAdmin(playerid)) return 0;
SetPlayerPos(playerid,1543.8469,-1353.4261,329.4741);
SetPlayerVirtualWorld(playerid, 5)
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 46);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
return 1;
}
But when i entered the server to use it, Before i login to my RCON, I typed /tower.
Then my position changed and my world changed too.
But, I want the command to work only if i'm logged in RCON.
Can you tell me what to do or what is the wrong in this command?
Re: Help please -
rymax99 - 11.08.2014
As I posted in your thread that was in the wrong section:
pawn Код:
if(strcmp("/tower",cmdtext,true) == 0)
{
if (!IsPlayerAdmin(playerid)) return 0;
SetPlayerPos(playerid,1543.8469,-1353.4261,329.4741);
SetPlayerVirtualWorld(playerid, 5)
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 46);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
return 1;
}
The '!' in 'if (!IsPlayerAdmin(playerid)) return 0;' means 'not', so if player is not admin, return 0. You could also return a message such as 'return SendClientMessage(playerid, -1, "Access denied");
https://sampwiki.blast.hk/wiki/Control_Structures
Re: Help please -
aCloudy - 11.08.2014
Quote:
Originally Posted by rymax99
As I posted in your thread that was in the wrong section:
pawn Код:
if(strcmp("/tower",cmdtext,true) == 0) { if (!IsPlayerAdmin(playerid)) return 0; SetPlayerPos(playerid,1543.8469,-1353.4261,329.4741); SetPlayerVirtualWorld(playerid, 5) ResetPlayerWeapons(playerid); GivePlayerWeapon(playerid, 46); SetPlayerHealth(playerid, 100); SetPlayerArmour(playerid, 100); return 1; }
The '!' in 'if (!IsPlayerAdmin(playerid)) return 0;' means 'not', so if player is not admin, return 0. You could also return a message such as 'return SendClientMessage(playerid, -1, "Access denied");
https://sampwiki.blast.hk/wiki/Control_Structures
|
Thank you very much.
Resolved.
Other question :
I don't know what is my scripting language name :P but it's "if(strcmp..." and others.
Can you tell me in my scripting language how to change "SERVER: Unknown Command" to something else ?
Re: Help please -
aCloudy - 11.08.2014
Anyone answer please ?
When i type wrong command, The system types "SERVER: Unknown command", How to change "SERVER: Unknown command" to other message ?
Re: Help please -
Stinged - 11.08.2014
You're using OnPlayerCommandText(playerid, cmdtext[])
So just replace return 0; at the end with "SendClientMessage(playerid, your color, "your message");"
But if you change to zcmd, delete all OnPlayerCommandText and add this to the script.
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if (!success)
return SendClientMessage(playerid, your color, "your message");
return 1;
}