24.09.2011, 14:53
Hi, I need a /goto [playerid] command for my gamemode, complete with everything. Can get one?
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;
}
pawn Код:
|
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
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;
}
#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;
}
best way:
pawn Код:
|