Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- FS de colocar o player no porta-malas
- Não retire os creditos.
- By: XxASxX YBanY
- */
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- #include <foreach>
- #undef MAX_PLAYERS
- #define MAX_PLAYERS (100)
- #define SendServerMessage(%0,%1) \
- SendClientMessageEx(%0, COLOR_SERVER, "{FFFFFF}SERVIDOR: "%1)
- #define SendErrorMessage(%0,%1) \
- SendClientMessageEx(%0, COLOR_LIGHTRED, "[ERRO]:{FFFFFF} "%1)
- #define SendSyntaxMessage(%0,%1) \
- SendClientMessageEx(%0, COLOR_GREY, "[SYNTAX]:{FFFFFF} "%1) // COLOR_YELLOW
- #define COLOR_PURPLE (0xD0AEEBFF)
- #define COLOR_SERVER (0xFFFF90FF)
- #define COLOR_LIGHTRED (0xFF6347FF)
- #define COLOR_GREY (0xAFAFAFFF)
- #define COLOR_RED (0xFF0000FF)
- new Tanoportamalas[MAX_PLAYERS];
- new
- pWorld[MAX_PLAYERS],
- pInterior[MAX_PLAYERS],
- pSpectator[MAX_PLAYERS],
- Float:pPos[4];
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" PlayerMala carregado |By: XxASxX|");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #else
- main()
- {
- print("\n----------------------------------");
- print(" PlayerMala descarregado |By: XxASxX|");
- print("----------------------------------\n");
- }
- #endif
- public OnGameModeInit()
- {
- return 1;
- }
- public OnGameModeExit()
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- Tanoportamalas[playerid] = 0;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- if (Tanoportamalas[playerid] == 1)
- {
- SendNearbyMessage(playerid, 35.0, COLOR_RED, "[Porta Malas]: {FFFFFF}%s diz: %s", ReturnName(playerid, 0), text);
- return 1;
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- return 0;
- }
- CMD:colocarnopmalas(playerid, params[])
- {
- static
- userid;
- new vehicleid = GetPlayerVehicleID(playerid);
- if (sscanf(params, "ud", userid))
- return SendSyntaxMessage(playerid, "/colocarnopmalas [playerid/nome]");
- if (userid == INVALID_PLAYER_ID || !IsPlayerNearPlayer(playerid, userid, 5.0))
- return SendErrorMessage(playerid, "O jogador não esta perto de voce.");
- if(!IsPlayerInAnyVehicle(userid)) return SendErrorMessage(playerid, "O jogador precisa está dentro do veículo (Para não bugar).");
- SetPlayerPos(userid, 2264.8218, -1213.3932, 1048.9272);
- SetPlayerInterior(userid, 1);
- Tanoportamalas[userid] = 1;
- SetPlayerVirtualWorld(userid, (playerid + 100));
- SetPlayerFacingAngle(userid, 0.0);
- if (GetPlayerState(userid) != PLAYER_STATE_SPECTATING)
- {
- GetPlayerPos(userid, pPos[0], pPos[1], pPos[2]);
- GetPlayerFacingAngle(userid, pPos[3]);
- pInterior[userid] = GetPlayerInterior(userid);
- pWorld[userid] = GetPlayerVirtualWorld(userid);
- }
- SetPlayerInterior(userid, GetPlayerInterior(vehicleid));
- SetPlayerVirtualWorld(userid, GetPlayerVirtualWorld(vehicleid));
- TogglePlayerSpectating(userid, 1);
- if (IsPlayerInAnyVehicle(playerid))
- PlayerSpectateVehicle(userid, GetPlayerVehicleID(playerid));
- else
- PlayerSpectatePlayer(userid, vehicleid);
- pSpectator[userid] = vehicleid;
- ApplyAnimationEx(userid, "BEACH", "ParkSit_M_loop", 4.1, 1, 0, 0, 0, 0, 1);
- SendServerMessage(userid, "Você está dentro do porta-malas.");
- SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "** %s colocou %s no porta malas.", ReturnName(playerid, 0), ReturnName(userid, 0));
- return 1;
- }
- CMD:retirardopmalas(playerid, params[])
- {
- static
- userid;
- if (sscanf(params, "u", userid))
- return SendSyntaxMessage(playerid, "/retirardopmalas [playerid/nome]");
- if(!IsPlayerInAnyVehicle(playerid))
- return SendErrorMessage(playerid, "Você precisa está dentro do veículo (Para não bugar).");
- if (userid == INVALID_PLAYER_ID)
- return SendErrorMessage(playerid, "Você especificou um jogador inválido.");
- new Float:X, Float:Y, Float:Z;
- if (Tanoportamalas[userid] == 1)
- {
- TogglePlayerSpectating(userid, false);
- Tanoportamalas[userid] = 0;
- pWorld[userid] = playerid;
- GetPlayerPos(playerid, X, Y, Z);
- SetPlayerPos(strval(params), X, Y, Z+1);
- SetPlayerVirtualWorld(userid, GetPlayerVirtualWorld(playerid));
- SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "** %s retirou %s do porta malas.", ReturnName(playerid, 0), ReturnName(userid, 0));
- }
- else SendErrorMessage(playerid, "Este player não está no porta-malas");
- return 1;
- }
- stock SendClientMessageEx(playerid, color, const text[], {Float, _}:...)
- {
- static
- args,
- str[144];
- /*
- * Custom function that uses #emit to format variables into a string.
- * This code is very fragile; touching any code here will cause crashing!
- */
- if ((args = numargs()) == 3)
- {
- SendClientMessage(playerid, color, text);
- }
- else
- {
- while (--args >= 3)
- {
- #emit LCTRL 5
- #emit LOAD.alt args
- #emit SHL.C.alt 2
- #emit ADD.C 12
- #emit ADD
- #emit LOAD.I
- #emit PUSH.pri
- }
- #emit PUSH.S text
- #emit PUSH.C 144
- #emit PUSH.C str
- #emit PUSH.S 8
- #emit SYSREQ.C format
- #emit LCTRL 5
- #emit SCTRL 4
- SendClientMessage(playerid, color, str);
- #emit RETN
- }
- return 1;
- }
- stock IsPlayerNearPlayer(playerid, targetid, Float:radius)
- {
- static
- Float:fX,
- Float:fY,
- Float:fZ;
- GetPlayerPos(targetid, fX, fY, fZ);
- return (GetPlayerInterior(playerid) == GetPlayerInterior(targetid) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(targetid)) && IsPlayerInRangeOfPoint(playerid, radius, fX, fY, fZ);
- }
- stock ApplyAnimationEx(playerid, animlib[], animname[], Float:fDelta, loop, lockx, locky, freeze, time, forcesync = 0)
- {
- ApplyAnimation(playerid, animlib, animname, fDelta, loop, lockx, locky, freeze, time, forcesync);
- return 1;
- }
- stock SendNearbyMessage(playerid, Float:radius, color, const str[], {Float,_}:...)
- {
- static
- args,
- start,
- end,
- string[144]
- ;
- #emit LOAD.S.pri 8
- #emit STOR.pri args
- if (args > 16)
- {
- #emit ADDR.pri str
- #emit STOR.pri start
- for (end = start + (args - 16); end > start; end -= 4)
- {
- #emit LREF.pri end
- #emit PUSH.pri
- }
- #emit PUSH.S str
- #emit PUSH.C 144
- #emit PUSH.C string
- #emit LOAD.S.pri 8
- #emit CONST.alt 4
- #emit SUB
- #emit PUSH.pri
- #emit SYSREQ.C format
- #emit LCTRL 5
- #emit SCTRL 4
- foreach (new i : Player)
- {
- if (IsPlayerNearPlayer(i, playerid, radius)) {
- SendClientMessage(i, color, string);
- }
- }
- return 1;
- }
- foreach (new i : Player)
- {
- if (IsPlayerNearPlayer(i, playerid, radius)) {
- SendClientMessage(i, color, str);
- }
- }
- return 1;
- }
- ReturnName(playerid, underscore=1)
- {
- static
- name[MAX_PLAYER_NAME + 1];
- GetPlayerName(playerid, name, sizeof(name));
- if (!underscore) {
- for (new i = 0, len = strlen(name); i < len; i ++) {
- if (name[i] == '_') name[i] = ' ';
- }
- }
- return name;
- }
Advertisement
Add Comment
Please, Sign In to add comment