27.10.2018, 18:55
Quote:
I told you earlier dont create multiple variable, one is enough to send multiple messages...
anyway here you go, with code optimization: pawn Код:
|
So if you're trying to do it right it with optimization if you're using a function to get a player's feature more than once, it would look more like so:
pawn Код:
CMD:gethere(playerid, params[])
{
if(pInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playerid,-1,""COL_RED"EROARE: You are not admin!");
new targetid;
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /get [playerid]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,COLOR_RED,"Player is not online");
new Float:x, Float:y, Float:z, string[128], SecondPlayerVeh, FirstPlayerWorld, FirstPlayerInt, bool:VehicleCheck;
if(IsPlayerInAnyVehicle(targetid)) VehicleCheck = true;
FirstPlayerInt = GetPlayerInterior(playerid);
FirstPlayerWorld = GetPlayerVirtualWorld(playerid);
SecondPlayerVeh = GetPlayerVehicleID(targetid);
GetPlayerPos(playerid, x, y, z);
SetPlayerInterior(targetid, FirstPlayerInt);
SetPlayerVirtualWorld(targetid, FirstPlayerWorld);
if(VehicleCheck)
{
SetVehicleVirtualWorld(SecondPlayerVeh, FirstPlayerWorld);
SetVehiclePos(SecondPlayerVeh, x, y, z);
LinkVehicleToInterior(SecondPlayerVeh, FirstPlayerInt);
PutPlayerInVehicle(targetid, SecondPlayerVeh, 0);
}
else SetPlayerPos_Allow(targetid, x, y, z);
format(string, sizeof(string), ""COL_RED"AdmCmds: %s %s has brought you to himself.", GetAdminName(playerid), PlayerName(playerid));
SendClientMessage(targetid, -1, string);
format(string, sizeof(string), ""COL_RED"%s %s used /gethere upon %s.", GetAdminName(playerid), PlayerName(playerid), PlayerName(targetid));
SendMessageToAllAdmins(string, -1);
return true;
}