Jump to content
  • 0

Comanda goto si gethere


Question

4 answers to this question

Recommended Posts

  • 0
Posted
45 minutes ago, adv1337 said:

Salut, la comanda /goto si /gethere vreau ca player-ul sa intre in masina automat, nu langa masina.
Comanda /goto:https://pastebin.com/qHAX04z9
Comanda /gethere:https://pastebin.com/tQP4yZPN
Multumesc Anticipat!

Poftim. Poti locui cum ai tu in Gamemode anumite culori, functii, texte, etc.

goto

Spoiler

YCMD:goto(playerid, params[], help) {
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "Nu esti logat!");
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        new id,string[256],sendername[30],giveplayer[30],countx;
        if(sscanf(params, "u", id)) return SendClientMessage(playerid, 0xFFFFFFFF, "{AB0000}Usage: {FFFFFF}/goto <name/playerid>");
        {
            if(id != INVALID_PLAYER_ID) {
                if(id == playerid) return SendClientMessage(playerid, COLOR_GREY, "Nu poti folosi aceasta comanda asupra ta.");
                if(CanSpectate[id] == 1) return SendClientMessage(playerid, COLOR_GREY, "Nu poti folosi aceasta comanda pe acest jucator.");
                if(Spectate[id] != -1) return SendClientMessage(playerid, COLOR_GREY, "That player is on spectating someone else.");
                new Float:ax,Float:ay,Float:az;
                GetPlayerPos(playerid,ax,ay,az);
                posxxx[playerid] = ax;
                posyyy[playerid] = ay;
                poszzz[playerid] = az;
                new Float:x, Float:y, Float:z;
                GetPlayerPos(id, x, y, z);
                new tmpcar = GetPlayerVehicleID(playerid), tmpcar2 = GetPlayerVehicleID(id);
                if (GetPlayerState(playerid) == 2) {
                    SetVehiclePos(tmpcar, x, y+4, z);
                    GetVehiclePos(tmpcar, old_veh_pos[tmpcar][0], old_veh_pos[tmpcar][1], old_veh_pos[tmpcar][2]);
                    LinkVehicleToInterior(tmpcar, GetPlayerInterior(id));
                    SetVehicleVirtualWorld(tmpcar, GetPlayerVirtualWorld(id));
                    OnPlayerGoto(playerid, GetPlayerInterior(id), GetPlayerVirtualWorld(id));
                }
                else
                {
                    if(GetPlayerState(id) == 2 || GetPlayerState(id) == 3)
                    {
                        new model = GetVehicleModel(GetPlayerVehicleID(id));
                        if(MaxSeats[model - 400] > 0)
                        {
                            for(new xx; xx < MaxSeats[model - 400]; xx++)
                            {
                                if(!IsSeatTaken(tmpcar2, xx))
                                {
                                    PutPlayerInVehicleEx(playerid, tmpcar2, xx);
                                    countx++;
                                    break;
                                }
                            }
                        }
                        else SetPlayerPosEx(playerid,x,y+2, z);
                    }
                    else SetPlayerPosEx(playerid,x,y+2, z);
                    if(countx == 0) SetPlayerPosEx(playerid,x,y+2, z);
                }
                SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(id));
                SetPlayerInterior(playerid, GetPlayerInterior(id));
                if(InHouse[id] > 0) {
                    InHouse[playerid] = InHouse[id];
                    if(strlen(housestring[InHouse[playerid]]) > 0)
                    {
                        StopAudioStreamForPlayer(playerid);
                        PlayAudioStreamForPlayer(playerid, housestring[InHouse[playerid]]);
                    }
                }
                if(InHQ[id] > 0) InHQ[playerid] = InHQ[id];
                if(InBussines[id] > 0) InBussines[playerid] = InBussines[id];
                GetPlayerName(playerid,sendername,sizeof(sendername));
                GetPlayerName(id,giveplayer,sizeof(giveplayer));
                format(string,sizeof(string),"You have been teleported to %s.",giveplayer);
                SendClientMessage(playerid, COLOR_GRAD1, string);
                format(string,sizeof(string),"Admin %s teleported to you.",sendername);
                SendClientMessage(id, COLOR_GRAD1, string);
            }
            else return SendClientMessage(playerid, COLOR_GREY, "Player not connected.");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_LIGHTGREEN3, AdminOnly);
    }
    return 1;
}

gethere

Spoiler

YCMD:gethere(playerid, params[], help) {
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "Nu esti logat!");
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pAdmin] >= 1)
        {
            new plo,sendername[30],giveplayer[30],string[256];
            if(sscanf(params, "u",plo)) return SendClientMessage(playerid, 0xFFFFFFFF, "{AB0000}Usage: {FFFFFF}/gethere <name/playerid>");
            new Float:plocx,Float:plocy,Float:plocz;
            if (IsPlayerConnected(plo)) {
                if(plo != INVALID_PLAYER_ID) {
                    if(plo == playerid) return SendClientMessage(playerid, COLOR_GREY, "Nu poti folosi aceasta comanda asupra ta.");
                    if(CanSpectate[plo] == 1) return SendClientMessage(playerid, COLOR_GREY, "Nu poti folosi aceasta comanda pe acest jucator.");
                    if(Spectate[plo] != -1) return SendClientMessage(playerid, COLOR_GREY, "That player is on spectating someone else.");
                    if(PlayerInfo[plo][pAdmin] >= 6 && PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_GREY, "Nu poti folosi aceasta comanda pe adminii de level 6+.");
                    GetPlayerPos(playerid, plocx, plocy, plocz);
                    SetPlayerInterior(plo,GetPlayerInterior(playerid));
                    PlayerInfo[plo][pInt] = PlayerInfo[playerid][pInt];
                    PlayerInfo[plo][pLocal] = PlayerInfo[playerid][pLocal];
                    if (GetPlayerState(plo) == 2)
                    {
                        TelePos[plo][0] = 0.0;
                        TelePos[plo][1] = 0.0;
                        new tmpcar = GetPlayerVehicleID(plo);
                        SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
                        GetVehiclePos(tmpcar, old_veh_pos[tmpcar][0], old_veh_pos[tmpcar][1], old_veh_pos[tmpcar][2]);
                    }
                    else
                    {
                        SetPlayerPosEx(plo,plocx,plocy+2, plocz);
                    }
                    if(InHouse[playerid] > 0)
                    {
                        InHouse[plo] = InHouse[playerid];
                        if(strlen(housestring[InHouse[plo]]) > 0) {
                            StopAudioStreamForPlayer(plo);
                            PlayAudioStreamForPlayer(plo, housestring[InHouse[plo]]);
                        }
                    }
                    if(InHQ[playerid] > 0)
                    {
                        InHQ[plo] = InHQ[playerid];
                    }
                    if(InBussines[playerid] > 0)
                    {
                        InBussines[plo] = InBussines[playerid];
                    }
                    SetPlayerVirtualWorld(plo, GetPlayerVirtualWorld(playerid));
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    GetPlayerName(plo, giveplayer, sizeof(giveplayer));
                    format(string,sizeof(string),"You have teleported %s to you.",giveplayer);
                    SendClientMessage(playerid, COLOR_GRAD1, string);
                    format(string,sizeof(string),"You have been teleported by admin %s.",sendername);
                    SendClientMessage(plo, COLOR_GRAD1, string);
                    if(PlayerInfo[plo][pPaintBallG] > 0)
                    {
                        foreach(new i : Player) {
                            if(PlayerInfo[pPaintBallG] == PlayerInfo[plo][pPaintBallG] && i != plo)
                            {
                                format(string,sizeof(string),"%s has left the paintball arena.", giveplayer);
                                SendClientMessage(i, COLOR_YELLOW, string);
                            }
                        }
                        curatj[plo] = 0;
                        for (new i = 0; i != 5; ++i) SendDeathMessageToPlayer(plo, 1001, 1001, 1001);
                        PlayerTextDrawHide(plo, PaintBallText[plo]);
                        SetPlayerSkin(plo, PlayerInfo[plo][pModel]);
                        paintp[PlayerInfo[plo][pPaintBallG]]--;
                        PlayerInfo[plo][pPaintBallG] = 0;
                        PlayerInfo[plo][pPaintBallKills] = 0;
                        PlayerInfo[plo][pPaintBallVoted] = 0;
                        PlayerInfo[plo][pPaintBallVoted2] = 0;
                        ResetPlayerWeaponsEx(plo);
                        ResetPlayerWeapons(plo);
                        SetPlayerArmourEx(plo, 0);
                        SetPlayerToTeamColor(plo);
                        SetPlayerWorldBounds(plo, 20000.0000, -20000.0000, 20000.0000, -20000.0000);
                    }
                }
            }
            else return SendClientMessage(playerid, COLOR_GREY, "Player not connected.");
        }
        else return SendClientMessage(playerid, COLOR_LIGHTGREEN3, AdminOnly);
    }
    return 1;
}

 

  • 0
Posted (edited)

Salut!

Pentru a face comanda /goto respectiv /gethere sa functioneze cu player-ul in masina iti recomand să folosești funcția GetPlayerState :

if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)

{

new vehid GetPlayerVehicleID(playerid);

PutPlayerInVehicle(playeridvehid0);

SCM(playerid, -1, ”Te-ai teleportat cu succes in masina player-ului.”);

}

 

Îți recomand să te documentezi despre aceste funcții pe wiki.sa-mp.ro sau pe wiki.sa-mp.com

 

La fel poți face si pentru gethere, dacă player-ul este in mașină atunci îl aduci cu tot cu mașină.

Edited by Джо

 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.