I need some help with a goto command and gethere - 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: I need some help with a goto command and gethere (
/showthread.php?tid=270106)
I need some help with a goto command and gethere -
Shockey HD - 19.07.2011
ive been searching hours with my freind, and we just cant seem to get this command.
We are looking for a /goto command and a /gethere command using DCMD.
This is for an admin script so the if player is an a admin looks like this.
Code:
if(PInfo[playerid][Level] < 2) return SendClientMessage(playerid,COLOR_RED,"You need to be level 2 to use this command!");
Re: I need some help with a goto command and gethere - [L3th4l] - 19.07.2011
pawn Code:
#if !defined isnull
#define isnull(%1) \
((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
dcmd_goto(playerid, params[])
{
if(PInfo[playerid][Level] < 2) return SendClientMessage(playerid,COLOR_RED,"You need to be level 2 to use this command!");
if(isnull(params)) return SendClientMessage(playerid, -1, "Usage: /Goto < Player ID >");
new
pID = strval(params),
Float: iPos[3];
GetPlayerPos(pID, iPos[0], iPos[1], iPos[2]);
SetPlayerPos(playerid, iPos[0], iPos[1], iPos[2] + 3);
new
iStr[50],
pIDN[24];
GetPlayerName(pID, pIDN, sizeof(pIDN));
format(iStr, sizeof(iStr), "You've teleported to: %s", pIDN);
return SendClientMessage(playerid, -1, iStr);
}
dcmd_gethere(playerid, params[])
{
if(PInfo[playerid][Level] < 2) return SendClientMessage(playerid,COLOR_RED,"You need to be level 2 to use this command!");
if(isnull(params)) return SendClientMessage(playerid, -1, "Usage: /Gethere < Player ID >");
new
pID = strval(params),
Float: iPos[3];
GetPlayerPos(playerid, iPos[0], iPos[1], iPos[2]);
SetPlayerPos(pID, iPos[0], iPos[1], iPos[2] + 3);
new
iStr[50],
pIDN[24];
GetPlayerName(pID, pIDN, sizeof(pIDN));
format(iStr, sizeof(iStr), "You've teleported: %s to you", pIDN);
return SendClientMessage(playerid, -1, iStr);
}
Re: I need some help with a goto command and gethere -
Shockey HD - 19.07.2011
Quote:
Originally Posted by [L3th4l]
pawn Code:
#if !defined isnull #define isnull(%1) \ ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1])))) #endif
dcmd_goto(playerid, params[]) { if(PInfo[playerid][Level] < 2) return SendClientMessage(playerid,COLOR_RED,"You need to be level 2 to use this command!"); if(isnull(params)) return SendClientMessage(playerid, -1, "Usage: /Goto < Player ID >");
new pID = strval(params), Float: iPos[3];
GetPlayerPos(pID, iPos[0], iPos[1], iPos[2]); SetPlayerPos(playerid, iPos[0], iPos[1], iPos[2] + 3);
new iStr[50], pIDN[24];
GetPlayerName(pID, pIDN, sizeof(pIDN));
format(iStr, sizeof(iStr), "You've teleported to: %s", pIDN); return SendClientMessage(playerid, -1, iStr); }
dcmd_gethere(playerid, params[]) { if(PInfo[playerid][Level] < 2) return SendClientMessage(playerid,COLOR_RED,"You need to be level 2 to use this command!"); if(isnull(params)) return SendClientMessage(playerid, -1, "Usage: /Gethere < Player ID >"); new pID = strval(params), Float: iPos[3];
GetPlayerPos(playerid, iPos[0], iPos[1], iPos[2]); SetPlayerPos(pID, iPos[0], iPos[1], iPos[2] + 3); new iStr[50], pIDN[24];
GetPlayerName(pID, pIDN, sizeof(pIDN));
format(iStr, sizeof(iStr), "You've teleported: %s to you", pIDN); return SendClientMessage(playerid, -1, iStr); }
|
Unkown Command
Re: I need some help with a goto command and gethere -
Skaizo - 19.07.2011
try this:
Code:
dcmd_goto(playerid, params[])
{
if(PlayerInfo[playerid][AdminLevel] == 0) return SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!");
{
new targetid;
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /goto [playerid | name]");
else if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xFFFFFFAA, "That player is not connected");
{
new Float:PosX, Float:PosY, Float:PosZ;
GetPlayerPos(targetid, PosX, PosY, PosZ);
SetPlayerPos(playerid, PosX, PosY, PosZ);
SetPlayerInterior(playerid, GetPlayerInterior(targetid));
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(targetid));
}
}
return 1;
}
you need dcmd and sscanf
Re: I need some help with a goto command and gethere -
Shockey HD - 19.07.2011
For every command i have Goto or Gethere it sends back UNkown Server command
Re: I need some help with a goto command and gethere -
coole210 - 19.07.2011
Did you forget to add
Code:
dcmd(goto,4,cmdtext);
to the OnPlayerCommandText?
Re: I need some help with a goto command and gethere -
Shockey HD - 19.07.2011
Quote:
Originally Posted by coole210
Did you forget to add
Code:
dcmd(goto,4,cmdtext);
to the OnPlayerCommandText?
|
Of course not