01.04.2016, 06:52
Here's a quick and easy command that uses zcmd, and sscanf. To teleport the player to an NPC. I use it for debugging. Use as you wish.
Код:
CMD:gotonpc(playerid, params[])
{
new targetid, string[128], string2[128], Float:X, Float:Y, Float:Z, vehid;
if(sscanf(params, "d", targetid)) return SendMessage(playerid, COLOR_RED, "USAGE: /gotonpc <NPCID>");
if(IsPlayerNPC(targetid))
{
GetPlayerPos(targetid, X, Y, Z);
SetPlayerPos(playerid, X, Y, Z);
if(IsPlayerInAnyVehicle(targetid))
{
vehid = GetPlayerVehicleID(targetid);
PutPlayerInVehicle(playerid, vehid, 1);
format(string, sizeof(string), "You have teleported to %s(%d)'s vehicle, and have been placed inside.", PlayerName(targetid), targetid);
SendMessage(playerid, COLOR_GREEN, string);
}
else if(!IsPlayerInAnyVehicle(targetid))
{
format(string2, sizeof(string2), "You have teleported to %s(%d)'s current location.", PlayerName(targetid), targetid);
SendMessage(playerid, COLOR_GREEN, string2);
}
}
else if(!IsPlayerNPC(targetid)) return SendMessage(playerid, COLOR_RED, "This player is not an NPC. Please use /goto for actual players.");
return 1;
}
