Jump to content
  • 0

Problema comanda port si get


Question

Posted

Salut.Am o problema cu comenzile /port si /get.Aceastea merg cand pe server sunt 3 playerii.Cu ID 0,1,2 dar cand intra cineva cu ID 3 cand dau get sau port actioneaza asupra playerului cu ID 0.Ce pot sa fac?Care sa mai intalnit cu asa ceva.

2 answers to this question

Recommended Posts

Posted

[pawn]COMMAND:get(playerid, params[])

{

// Setup local variables

new OtherPlayer, Float:x, Float:y, Float:z, PortMsg[128], IntID, WorldID, Name[24];

// Send the command to all admins so they can see it

SendAdminText(playerid, "/get", 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)

{

if (sscanf(params, "u", OtherPlayer)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/get <OtherPlayer>\"");

else

{

// Check if that other player is online

if (IsPlayerConnected(OtherPlayer))

{

// Get the name of the other player

GetPlayerName(OtherPlayer, Name, sizeof(Name));

// Get the location of the player

GetPlayerPos(playerid, x, y, z);

IntID = GetPlayerInterior(playerid);

WorldID = GetPlayerVirtualWorld(playerid);

// Port the other player to this player

SetPlayerVirtualWorld(OtherPlayer, WorldID);

SetPlayerInterior(OtherPlayer, IntID);

SetPlayerPos(OtherPlayer, x, y, z + 3.0);

// Let the player know about it

format(PortMsg, 128, "{00FF00}You have ported {FFFF00}%s{00FF00} to your location", Name);

SendClientMessage(playerid, 0xFFFFFFFF, PortMsg);

}

else

    SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't online");

}

}

else

    return 0;

}

else

    return 0;

// Let the server know that this was a valid command

return 1;

}[/pawn]

[pawn]COMMAND:port(playerid, params[])

{

// Setup local variables

new OtherPlayer, Float:x, Float:y, Float:z, PortMsg[128], IntID, WorldID;

// Send the command to all admins so they can see it

SendAdminText(playerid, "/port", 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, "u", OtherPlayer)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/port <OtherPlayer>\"");

else

{

// Check if that other player is online

if (IsPlayerConnected(OtherPlayer))

{

// Get the location of the other player

GetPlayerPos(OtherPlayer, x, y, z);

IntID = GetPlayerInterior(OtherPlayer);

WorldID = GetPlayerVirtualWorld(OtherPlayer);

// Port the player to the given location

SetPlayerVirtualWorld(playerid, WorldID);

SetPlayerInterior(playerid, IntID);

SetPlayerPos(playerid, x, y, z + 3.0);

// Let the player know about it

format(PortMsg, 128, "You have been ported to location: %4.2f, %4.2f, %4.2f", x, y, z + 3.0);

SendClientMessage(playerid, 0x00FF00FF, PortMsg);

}

else

    SendClientMessage(playerid, 0xFF0000FF, "That player isn't online");

}

}

else

    SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /port when you're in jail");

}

else

    SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /port when you're wanted");

}

else

    return 0;

}

else

    return 0;

// Let the server know that this was a valid command

return 1;

}[/pawn]

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.