06.05.2013, 00:52
Something is blocking my command.
Ports one player to another player
debug
How i fix it?
it work like
/tele 0 0
Ports one player to another player
Код:
COMMAND:tele(playerid, params[]) { // Setup local variables new Player1, Player2, Float:x, Float:y, Float:z, PortMsg[128], IntID, WorldID, Name[24], AdminName[24]; // Send the command to all admins so they can see it SendAdminText(playerid, "/tele", 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, "uu", Player1, Player2)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /tele [PlayerToPort] [TargetPlayer]"); else { // Check if player1 is online if (APlayerData[Player1][LoggedIn] == true) { // Check if player2 is online if (APlayerData[Player2][LoggedIn] == true) { // Get the name of the admin and the second player GetPlayerName(playerid, AdminName, sizeof(AdminName)); GetPlayerName(Player2, Name, sizeof(Name)); // Get the location of the second player GetPlayerPos(Player2, x, y, z); IntID = GetPlayerInterior(Player2); WorldID = GetPlayerVirtualWorld(Player2); // Port the first player to player2's location SetPlayerVirtualWorld(Player1, WorldID); SetPlayerInterior(Player1, IntID); SetPlayerPos(Player1, x, y, z + 3.0); // Let the first player know he's been ported format(PortMsg, 128, "You have been ported to player %s by %s", Name, AdminName); SendClientMessage(Player1, 0xFFFFFFFF, PortMsg); } else SendClientMessage(playerid, 0xFF0000FF, "ERROR: Player2 isn't online"); } else SendClientMessage(playerid, 0xFF0000FF, "ERROR: Player1 isn't online"); } } else return 0; } else return 0; // Let the server know that this was a valid command return 1; }
Код:
[debug] Run time error 4: "Array index out of bounds" [debug] Accessing element at index 65535 past array upper bound 49 [debug] AMX backtrace: [debug] #0 00058e50 in public cmd_tele () from PPC_Trucking.amx [debug] #1 native CallLocalFunction () [00471e90] from samp-server.exe [debug] #2 00000770 in public OnPlayerCommandText () from PPC_Trucking.amx
it work like
/tele 0 0