Making commands[Need some 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: Making commands[Need some help please] (
/showthread.php?tid=357483)
Making commands[Need some help please] -
Josh_Main - 07.07.2012
This may sound nooby, but im a noob haha. When i make a command:
Код HTML:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/tpallsaints", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid,1201.29,-1325.50,13.40);
SendClientMessage(playerid, 0x808080FF, "You have been teleported to All Saints General Hospital (Los Santos)");
return 1;
}
return 0;
}
If i want to make another command in the script, what do i have to do? do i have to put public OnplayerCommandText(playerid, cmdtext[]) or do i just start at "if"? Also, what do i have to return the values too?
Thanks in advanced
Re: Making commands[Need some help please] -
Infinity90 - 07.07.2012
Like this
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/tpallsaints", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid,1201.29,-1325.50,13.40);
SendClientMessage(playerid, 0x808080FF, "You have been teleported to All Saints General Hospital (Los Santos)");
return 1;
}
if(strcmp("/example",cmdtext,true,10) == 0)
{
SetPlayerPos(playerid, 342,234,234);
return 1;
}
//Another command here
return 0;
}
Re: Making commands[Need some help please] -
Cxnnor - 07.07.2012
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/tpallsaints", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid,1201.29,-1325.50,13.40);
SendClientMessage(playerid, 0x808080FF, "You have been teleported to All Saints General Hospital (Los Santos)");
return 1;
}
else if(!strcmp(cmdtext,"/example",true))
{
// Post your function.
return 1;
}
return 0;
}
Re: Making commands[Need some help please] -
Josh_Main - 07.07.2012
Thank you