SA-MP Forums Archive
[HELP] Two commands - 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] Two commands (/showthread.php?tid=553938)



[HELP] Two commands - Zekiloni - 01.01.2015

How to make two commands but same function (no command system)
exp.
/goto
Goto to player id
/tele
Run /goto

And how to make commands in command xD
exp.
/tele
LS
LV
SF


Re: [HELP] Two commands - Desi_Dude - 01.01.2015

This is quite handy to you.

LINK

If you still don't understand something just ask back .


Re: [HELP] Two commands - Diti1 - 01.01.2015

here you go try this
Quote:

CMD:goto(playerid,params[])
{
new ID;
new Float:X;
new Float:Y;
new Float:Z;
new Float:A;
if(sscanf(params,"i", ID)) return SendClientMessage(playerid,-1,"{FF0000}AdmUsage: {15FF00}/Goto [PlayerID]");
GetPlayerPos(ID, X,Y,Z);
GetPlayerFacingAngle(ID, A);
SetPlayerPos(playerid, X,Y,Z);
SetPlayerFacingAngle(playerid, A);
SendClientMessage(playerid, -1, "{FF0000}Cmd: {15FF00}You teleported to specified player !");
return 1;
}




Re: [HELP] Two commands - Desi_Dude - 01.01.2015

Here is a /tele command.

with the explaination,

Hope it's clear.

Код:
CMD:tele(playerid, params[])
{
	if(isnull(params)) // IF you didn't type any parameter... then It'll show you the option.
	{ //then
		SendClientMessage(playerid, -1, "* Usage: /tele [input]"); //send this message
		SendClientMessage(playerid, -1, " *** LS,SF,LV"); // Locations you can TP to
		return 1;
	}

	if(strcmp(params,"ls",true) == 0) //if player types the parameter "ls"
	{ //then
		SetPlayerPos(playerid, 0, 0, 0); // sets the player's position to this coordinates.
	}
	else if (strcmp(params,"sf",true) == 0) //else if player types the params "sf"
	{ //then
		SetPlayerPos(playerid, 0, 0, 0); // sets the player's position to this coordinates.
	}
	else if (strcmp(params,"lv",true) == 0) //else if player types the params "lv"
	{ //then
		SetPlayerPos(playerid, 0, 0, 0);// sets the player's position to this coordinates.
	}
	return 1; // returns as true
}



Re: [HELP] Two commands - Zekiloni - 01.01.2015

it's not ZCMD, there no have cmd procesor.
and no one help me


Re: [HELP] Two commands - Desi_Dude - 01.01.2015

Quote:
Originally Posted by Zekiloni
Посмотреть сообщение
it's not ZCMD, there no have cmd procesor.
and no one help me
Ok there is the explantion for the /goto command.

Код:
CMD:goto(playerid,params[])
{
	new ID, //
		Float:X,
		Float:Y,
		Float:Z,
		Float:A;
	if(sscanf(params,"i", ID)) return SendClientMessage(playerid,-1,"* Usage: /goto [player]"); // Refer to my previous explaination.
	GetPlayerPos(ID, X,Y,Z); // Getting position of the player you want to TP to.
	GetPlayerFacingAngle(ID, A); // Getting his facing angle.
	SetPlayerPos(playerid, X,Y+5,Z); // Setting your position , playerid refers to you & ID refers to the player you're wanting to TP to.
	SetPlayerFacingAngle(playerid, A); // setting your facing angle
	SendClientMessage(playerid, -1, " You have successfully been teleported.");
	return 1;
}



Re: [HELP] Two commands - Zekiloni - 01.01.2015

i don't need goto/teleport commands, it's example, read the again


Re: [HELP] Two commands - Desi_Dude - 01.01.2015

Quote:
Originally Posted by Zekiloni
Посмотреть сообщение
i don't need goto/teleport commands, it's example, read the again
Isn't that an example I gave you..?
I explained aswell.
What else do you need, please be specific.!


Re: [HELP] Two commands - rickisme - 01.01.2015

sorry but you asking people help but don't explain clearly your question, so how we can help you ?
Create commands but don't want commands system ? OnPlayerCommandText or what ?


Re: [HELP] Two commands - Wizzy951 - 01.01.2015

It's obvious that this guy is using strcmp. Here is an example of how to make multiple commands, executed doing the same function:

pawn Код:
if(!strcmp(cmdtext[4],"goto",true) || !strcmp(cmdtext[4],"tele",true))
But still it's better to use some faster commands processor like ZCMD.