if(IsPlayerInAnyVehicle(playerid))
#3

I told you earlier dont create multiple variable, one is enough to send multiple messages...
anyway here you go, with code optimization:
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)) SendClientMessage(playerid,-1,""COL_RED"AdmCmds: /gethere [PlayerID]");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""COL_RED"ERROR: Not online!");
   
    new Float:x,Float:y,Float:z, string[128];
    SetPlayerInterior(targetid, GetPlayerInterior(playerid));
    SetPlayerVirtualWorld(targetid, GetPlayerVirtualWorld(playerid));
    GetPlayerPos(playerid,Float:x,Float:y,Float:z);
    SetPlayerPos_Allow(targetid,Float:x,Float:y,Float:z);
   
    if(IsPlayerInAnyVehicle(targetid))
    {
        SetVehiclePos(GetPlayerVehicleID(targetid), x, y, z);
        LinkVehicleToInterior(GetPlayerVehicleID(targetid),GetPlayerInterior(playerid));
        PutPlayerInVehicle(targetid, GetPlayerVehicleID(targetid), 0);
    }
   
    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 1;
}
EDIT: didnt see Rogues message, i guess his way is better
Reply


Messages In This Thread
if(IsPlayerInAnyVehicle(playerid)) - by Zeus666 - 27.10.2018, 18:30
Re: if(IsPlayerInAnyVehicle(playerid)) - by RogueDrifter - 27.10.2018, 18:39
Re: if(IsPlayerInAnyVehicle(playerid)) - by ReD_HunTeR - 27.10.2018, 18:44
Re: if(IsPlayerInAnyVehicle(playerid)) - by RogueDrifter - 27.10.2018, 18:55

Forum Jump:


Users browsing this thread: 1 Guest(s)