04.04.2013, 22:34
i want a /portloc cmd and put cords and tele port to were the cords were
here is one of the cmds i use
if you dont understand me here is a cmd of what i mean but its in another type
thanks
here is one of the cmds i use
pawn Код:
if(strcmp(cmd, "/goto", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_ERROR, "Syntax: /goto (playername/id)");
return 1;
}
new Float:plocx,Float:plocy,Float:plocz;
new plo;
plo = ReturnUser(tmp);
if(IsPlayerNPC(plo)) return 1;
if(IsPlayerConnected(plo))
{
if(plo != INVALID_PLAYER_ID)
{
if(PInfo[playerid][AdminLevel] >= 1)
{
new interior = GetPlayerInterior(plo);
new vw = GetPlayerVirtualWorld(plo);
SetPlayerVirtualWorld(playerid,vw);
SetPlayerInterior(playerid,interior);
GetPlayerPos(plo, plocx, plocy, plocz);
if(GetPlayerState(playerid) == 2)
{
new tmpcar = GetPlayerVehicleID(playerid);
SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
}
else
{
SetPlayerPos(playerid,plocx,plocy+2, plocz);
}
new sendmsg[128];
format(sendmsg,sizeof(sendmsg),"Administrator {FF9900}%s(%d) {FFFFFF}has teleported to your location.", PlayerName(playerid), playerid);
SendClientMessage(plo, COLOR_WHITE, sendmsg);
format(sendmsg,sizeof(sendmsg),"You have teleported to {FF9900}%s's(%d) {FFFFFF}location.", PlayerName(plo), plo);
SendClientMessage(playerid, COLOR_WHITE, sendmsg);
AdminLog(playerid, "/teleto", "Teleported To", PlayerName(plo));
return 1;
}
else
{
SendClientMessage(playerid, COLOR_ERROR, "You are not an administrator !");
}
}
}
else
{
format(string, sizeof(string), "Could not find player (%d)", plo);
SendClientMessage(playerid, COLOR_ERROR, string);
}
}
return 1;
}
pawn Код:
COMMAND:portloc(playerid, params[])
{
// Setup local variables
new Float:x, Float:y, Float:z, PortMsg[128];
// Send the command to all admins so they can see it
SendAdminText(playerid, "/portloc", params);
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player's admin-level is at least 1
if (APlayerData[playerid][PlayerLevel] >= 1)
{
// Check if the player has a wanted level of less than 3
if (GetPlayerWantedLevel(playerid) < 3)
{
// Check if the player is not jailed
if (APlayerData[playerid][PlayerJailed] == 0)
{
if (sscanf(params, "fff", x, y, z)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/portloc <x> <y> <z>\"");
else
{
// Port the player to the given location
SetPlayerPos(playerid, x, y, z);
// Let the player know about it
format(PortMsg, 128, "You have been ported to location: %4.2f, %4.2f, %4.2f", x, y, z);
SendClientMessage(playerid, 0x00FF00FF, PortMsg);
}
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /portloc when you're in jail");
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /portloc when you're wanted");
}
else
return 0;
}
else
return 0;
// Let the server know that this was a valid command
return 1;
}