Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //In cima alla tua GM:
- #define VIOLA 0xC2A2DAAA
- new munizioni;
- new arma;
- new bool:pieno[MAX_PLAYERS];
- //OnPlayerCommandText
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/mettizaino", cmdtext, true) == 0)
- {
- new string[128];
- new nome[MAX_PLAYER_NAME];
- munizioni = GetPlayerAmmo(playerid);
- arma = GetPlayerWeapon(playerid);
- if(munizioni == 0 && arma == 0) return SendClientMessage(playerid, 0xFF000000, "* Non hai nessuna arma da mettere!!!");
- if(pieno[playerid] == true) return SendClientMessage(playerid, 0xFF000000, "* Zaino Pieno!!!");
- RemovePlayerWeapon(playerid, arma);
- GetPlayerName(playerid,nome,30);
- format(string, 128, "* %s prende un arma e la mette nello zaino.", nome);
- ProxDetector(10.0, playerid, string, VIOLA,VIOLA,VIOLA,VIOLA,VIOLA);
- pieno[playerid] = true;
- return 1;
- }
- if (strcmp("/prendizaino", cmdtext, true) == 0)
- {
- new string[128];
- new nome[MAX_PLAYER_NAME];
- if(pieno[playerid] == false) return SendClientMessage(playerid, 0xFF000000, "* Non hai nessuna arma nello zaino!!!");
- GivePlayerWeapon(playerid, arma, munizioni);
- GetPlayerName(playerid,nome,30);
- format(string, 128, "* %s prende un arma dallo zaino.", nome);
- ProxDetector(10.0, playerid, string, VIOLA,VIOLA,VIOLA,VIOLA,VIOLA);
- munizioni = 0;
- arma = 0;
- pieno[playerid] = false;
- return 1;
- }
- if (strcmp("/aprizaino", cmdtext, true) == 0)
- {
- new nomearma[32], string[64], string2[128],nome[MAX_PLAYER_NAME];
- GetWeaponName(arma,nomearma,32);
- GetPlayerName(playerid,nome,30);
- if(pieno[playerid] == false) return SendClientMessage(playerid, 0xFF000000, "* Non hai nessuna arma nello zaino!!!");
- SendClientMessage(playerid, 0xFF0000FF, "-----------------------------------");
- format(string,128,"Attuale arma nello zaino: %s Munizioni: %d", nomearma, munizioni);
- SendClientMessage(playerid, 0xFFFFFFFF, string);
- SendClientMessage(playerid, 0xFF0000FF, "-----------------------------------");
- format(string2, 128, "* %s apre lo zaino e guarda il suo contenuto.", nome);
- ProxDetector(10.0, playerid, string2, VIOLA,VIOLA,VIOLA,VIOLA,VIOLA);
- return 1;
- }
- return 0;
- }
- //In Fondo alla tua GM:
- forward RemovePlayerWeapon(playerid, weaponid);
- public RemovePlayerWeapon(playerid, weaponid)
- {
- new plyWeapons[12] = 0;
- new plyAmmo[12] = 0;
- for(new slot = 0; slot != 12; slot++)
- {
- new wep, ammo;
- GetPlayerWeaponData(playerid, slot, wep, ammo);
- if(wep != weaponid && ammo != 0)
- {
- GetPlayerWeaponData(playerid, slot, plyWeapons[slot], plyAmmo[slot]);
- }
- }
- ResetPlayerWeapons(playerid);
- for(new slot = 0; slot != 12; slot++)
- {
- if(plyAmmo[slot] != 0)
- {
- GivePlayerWeapon(playerid, plyWeapons[slot], plyAmmo[slot]);
- }
- }
- return 1;
- }
- forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
- public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
- {
- if(IsPlayerConnected(playerid))
- {
- new Float:posx, Float:posy, Float:posz;
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
- {
- GetPlayerPos(i, posx, posy, posz);
- tempposx = (oldposx -posx);
- tempposy = (oldposy -posy);
- tempposz = (oldposz -posz);
- if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
- {
- SendClientMessage(i, col1, string);
- }
- else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
- {
- SendClientMessage(i, col2, string);
- }
- else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
- {
- SendClientMessage(i, col3, string);
- }
- else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
- {
- SendClientMessage(i, col4, string);
- }
- else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- SendClientMessage(i, col5, string);
- }
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment