Need a /goto command... -
Macros50 - 24.09.2011
Hi, I need a /goto [playerid] command for my gamemode, complete with everything. Can get one?
Re: Need a /goto command... - Max_Coldheart - 24.09.2011
pawn Код:
YCMD:goto(playerid, o[], help)
{
#pragma unused help
new pID;
if(sscanf(o,"u", pID)) return SendClientMessage(playerid, -1,"Syntax error.Correct usage: /goto [PlayerID/Name]");
if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1,"That player is not connected");
new Float:x, Float:y, Float:z;
GetPlayerPos(pID, x, y, z);
SetPlayerPos(playerid, x+1, y+1, z);
return 1;
}
Notice: this is using YCMD and sscanf2
Re: Need a /goto command... -
Kingunit - 24.09.2011
Next time, you can use the search function ...
Re: Need a /goto command... -
[MWR]Blood - 24.09.2011
Search.
There are lots of threads like this.
Not to mention the admin systems which contain the command you want.
Re: Need a /goto command... -
grand.Theft.Otto - 24.09.2011
Quote:
Originally Posted by Max_Coldheart
pawn Код:
YCMD:goto(playerid, o[], help) { #pragma unused help new pID; if(sscanf(o,"u", pID)) return SendClientMessage(playerid, -1,"Syntax error.Correct usage: /goto [PlayerID/Name]"); if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1,"That player is not connected"); new Float:x, Float:y, Float:z; GetPlayerPos(pID, x, y, z); SetPlayerPos(playerid, x+1, y+1, z); return 1; }
Notice: this is using YCMD and sscanf2
|
You can't just assume people are using/have the ZCMD/YCMD/DCMD and sscanf includes ...
Re: Need a /goto command... -
Macros50 - 24.09.2011
sorry i tryed, get me error the pawno, can make one with normal string if (strcmp("/mycommand", cmdtext, true, 10) == 0)?
this the error:
Код:
C:\Users\User\Desktop\ServerMacros\gamemodes\MacrosGM.pwn(1832) : error 020: invalid symbol name ""
C:\Users\User\Desktop\ServerMacros\gamemodes\MacrosGM.pwn(1832) : warning 215: expression has no effect
C:\Users\User\Desktop\ServerMacros\gamemodes\MacrosGM.pwn(1832) : error 017: undefined symbol "o"
C:\Users\User\Desktop\ServerMacros\gamemodes\MacrosGM.pwn(1832) : error 029: invalid expression, assumed zero
C:\Users\User\Desktop\ServerMacros\gamemodes\MacrosGM.pwn(1832) : fatal error 107: too many error messages on one line
Re: Need a /goto command... -
grand.Theft.Otto - 24.09.2011
Place under OnPlayerCommandText:
pawn Код:
if(strcmp(cmd, "/goto", true, 5) == 0 && IsPlayerAdmin(playerid))
{
new giveplayerid, tmp[256], idx, string[128];
tmp = strtok(cmdtext, idx);
giveplayerid = strval(tmp);
if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USAGE: /goto [id]");
if(!IsNumeric(tmp)) return SendClientMessage(playerid, -1, "USAGE: /goto [id] - ID Must Be A Number.");
if(IsPlayerConnected(giveplayerid))
{
SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
new Float:x, Float:y, Float:z;
GetPlayerPos(giveplayerid, x,y,z);
SetPlayerPos(playerid, x+1,y,z);
}
else
{
format(string, sizeof(string), "%d Is Not An Active Player.", giveplayerid);
SendClientMessage(playerid, -1, string);
}
return 1;
}
Re: Need a /goto command... -
Kaperstone - 24.09.2011
best way:
pawn Код:
#include <zcmd>
CMD:goto(playerid, params[])
{
new
id;
if(sscanf(params,"r",id)) {
if(IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_LIGHTRED, "[MM] this player id is not connected!");
new Float:X,Float:Y,Float:Z,Float:Angle;
new message[40];
GetPlayerPos(id, X, Y, Z);
GetPlayerFacingAngle(playerid, Angle);
SetPlayerPos(playerid, X, Y, Z);
SetPlayerFacingAngle(playerid, Angle);
format(message, sizeof(message), "[MM] You have teleported to %d", id);
SendClientMessage(playerid, COLOR_GREEN, message);
format(message, sizeof(message), "[MM] %d has been teleported to you", playerid);
SendClientMessage(playerid, COLOR_GREEN, message);
}
else {
SendClientMessage(playerid, COLOR_LIGHTRED,"[MM] USAGE: /goto [playerid]");
}
return 1;
}
Re: Need a /goto command... - Max_Coldheart - 24.09.2011
Quote:
Originally Posted by grand.Theft.Otto
You can't just assume people are using/have the ZCMD/YCMD/DCMD and sscanf includes ...
|
Probably thats why there reads "NOTE: This uses YCMD & sscanf2 ?
Re: Need a /goto command... -
Kingunit - 24.09.2011
Quote:
Originally Posted by xkirill
best way:
pawn Код:
#include <zcmd>
CMD:goto(playerid, params[]) { new id; if(sscanf(params,"r",id)) { if(IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_LIGHTRED, "[MM] this player id is not connected!"); new Float:X,Float:Y,Float:Z,Float:Angle; new message[40]; GetPlayerPos(id, X, Y, Z); GetPlayerFacingAngle(playerid, Angle); SetPlayerPos(playerid, X, Y, Z); SetPlayerFacingAngle(playerid, Angle); format(message, sizeof(message), "[MM] You have teleported to %d", id); SendClientMessage(playerid, COLOR_GREEN, message); format(message, sizeof(message), "[MM] %d has been teleported to you", playerid); SendClientMessage(playerid, COLOR_GREEN, message); } else { SendClientMessage(playerid, COLOR_LIGHTRED,"[MM] USAGE: /goto [playerid]"); } return 1; }
|
That one is using sscsanf. You didn't included that.