SA-MP Forums Archive
Cуdigos Ъteis #1 - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+----- Forum: Lançamentos/Releases (https://sampforum.blast.hk/forumdisplay.php?fid=56)
+----- Thread: Cуdigos Ъteis #1 (/showthread.php?tid=144744)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29


Re: Cуdigos Ъteis #1 - Sants - 30.06.2020

Criar e destruir veiculo com o mesmo comando (Limitaзгo para criar 1 veнculo)
pawn Code:
//Includes usadas: ZCMD, sscanf2
//Crйditos aos donos das includes.


new carroc[MAX_PLAYERS];// Topo da GM



//Final da GM
CMD:v(playerid, params[]) {
    new modelo;

    if(sscanf(params, "d", modelo)){
        return SendClientMessage(playerid, -1, "{FFFF00}(ERRO) Use: /V [ID]");
    }
    if(modelo < 400 || modelo > 611) return SendClientMessage(playerid, -1, "{FFFF00}(ERRO) Use uma ID vбlida");   
    DestroyVehicle(carroc[playerid]);
    new Float:ppx, Float:ppy,Float:ppz,Float:ppa;
    GetPlayerPos(playerid, ppx, ppy, ppz);
    GetPlayerFacingAngle(playerid, ppa);
    carroc[playerid] = CreateVehicle(modelo, Float:ppx, Float:ppy, Float:ppz, Float:ppa, 0, 0, -1, 0)
    SetVehicleHealth(carroc[playerid], 2000);
    new vw;
    vw = GetPlayerVirtualWorld(playerid);
    SetVehicleVirtualWorld(carroc[playerid], vw);
    PutPlayerInVehicle(playerid, carroc[playerid], 0);
    new msg2[120];
    format(msg2, sizeof(msg2), "(INFO) Veнculo ID {FFFF00}(%d) {FFFFFF}criado com sucesso ", modelo);
    SendClientMessage(playerid, -1, msg2);
    return 1;
}