APLY-ZONE
Bine ai venit vizitatorule, daca vrei sa ai acces la toate resursele forumului trebuie sa detii un cont. Daca nu detii unul deja iti poti face un cont nou aici : http://aply-zone.forumotion.com/register?agreed=true&step=2

Show Weapons

In jos

Show Weapons

Mesaj Scris de Versus la data de Dum Aug 11, 2013 9:50 am

Salut, am vazut ca mai multe persoane care sunt la inceput in cea ce priveste scriptingul si intreaba cum fac ca sa aive lipite de corp armele pe care le detine si asa m-am decis sa va arat eu scriptingul "Show Weapons".

1. Adaugam langa celelalte "static" urmatorul lucru: (Insa daca nu avem "static" adaugam la inceputul GameMode-ului dupa "include")

static armedbody_pTick[MAX_PLAYERS];
2. Adaugam langa celelalte "define" urmatorul lucru:

#define ARMEDBODY_USE_HEAVY_WEAPON (false)
3. Adaugam la "public OnPlayerUpdate(playerid)" urmatorul lucru:

if(GetTickCount() - armedbody_pTick[playerid] > 113)
{
new weaponid[13];
new weaponammo[13];
new pArmedWeapon;
pArmedWeapon = GetPlayerWeapon(playerid);
GetPlayerWeaponData(playerid,1,weaponid[1],weaponammo[1]);
GetPlayerWeaponData(playerid,2,weaponid[2],weaponammo[2]);
GetPlayerWeaponData(playerid,4,weaponid[4],weaponammo[4]);
GetPlayerWeaponData(playerid,5,weaponid[5],weaponammo[5]);
#if ARMEDBODY_USE_HEAVY_WEAPON
GetPlayerWeaponData(playerid,7,weaponid[7],weaponammo[7]);
#endif
if(weaponid[1] && weaponammo[1] > 0){
if(pArmedWeapon != weaponid[1]){
if(!IsPlayerAttachedObjectSlotUsed(playerid,0)){
SetPlayerAttachedObject(playerid,0,GetWeaponModel(weaponid[1]),1, 0.199999, -0.139999, 0.030000, 0.500007, -115.000000, 0.000000, 1.000000, 1.000000, 1.000000);
}
}
else {
if(IsPlayerAttachedObjectSlotUsed(playerid,0)){
RemovePlayerAttachedObject(playerid,0);
}
}
}
else if(IsPlayerAttachedObjectSlotUsed(playerid,0)){
RemovePlayerAttachedObject(playerid,0);
}
if(weaponid[2] && weaponammo[2] > 0){
if(pArmedWeapon != weaponid[2]){
if(!IsPlayerAttachedObjectSlotUsed(playerid,1)){
SetPlayerAttachedObject(playerid,1,GetWeaponModel(weaponid[2]),8, -0.079999, -0.039999, 0.109999, -90.100006, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000);
}
}
else {
if(IsPlayerAttachedObjectSlotUsed(playerid,1)){
RemovePlayerAttachedObject(playerid,1);
}
}
}
else if(IsPlayerAttachedObjectSlotUsed(playerid,1)){
RemovePlayerAttachedObject(playerid,1);
}
if(weaponid[4] && weaponammo[4] > 0){
if(pArmedWeapon != weaponid[4]){
if(!IsPlayerAttachedObjectSlotUsed(playerid,2)){
SetPlayerAttachedObject(playerid,2,GetWeaponModel(weaponid[4]),7, 0.000000, -0.100000, -0.080000, -95.000000, -10.000000, 0.000000, 1.000000, 1.000000, 1.000000);
}
}
else {
if(IsPlayerAttachedObjectSlotUsed(playerid,2)){
RemovePlayerAttachedObject(playerid,2);
}
}
}
else if(IsPlayerAttachedObjectSlotUsed(playerid,2)){
RemovePlayerAttachedObject(playerid,2);
}
if(weaponid[5] && weaponammo[5] > 0){
if(pArmedWeapon != weaponid[5]){
if(!IsPlayerAttachedObjectSlotUsed(playerid,3)){
SetPlayerAttachedObject(playerid,3,GetWeaponModel(weaponid[5]),1, 0.200000, -0.119999, -0.059999, 0.000000, 206.000000, 0.000000, 1.000000, 1.000000, 1.000000);
}
}
else {
if(IsPlayerAttachedObjectSlotUsed(playerid,3)){
RemovePlayerAttachedObject(playerid,3);
}
}
}
else if(IsPlayerAttachedObjectSlotUsed(playerid,3)){
RemovePlayerAttachedObject(playerid,3);
}
#if ARMEDBODY_USE_HEAVY_WEAPON
if(weaponid[7] && weaponammo[7] > 0){
if(pArmedWeapon != weaponid[7]){
if(!IsPlayerAttachedObjectSlotUsed(playerid,4)){
SetPlayerAttachedObject(playerid,4,GetWeaponModel(weaponid[7]),1,-0.100000, 0.000000, -0.100000, 84.399932, 112.000000, 10.000000, 1.099999, 1.000000, 1.000000);
}
}
else {
if(IsPlayerAttachedObjectSlotUsed(playerid,4)){
RemovePlayerAttachedObject(playerid,4);
}
}
}
else if(IsPlayerAttachedObjectSlotUsed(playerid,4)){
RemovePlayerAttachedObject(playerid,4);
}
#endif
armedbody_pTick[playerid] = GetTickCount();
}
4. Adaugam langa celelalte "stock" urmatorul lucru: (Sau la sfarsitul GameMode-ului)

stock GetWeaponModel(weaponid)
{
switch(weaponid)
{
case 1:
return 331;

case 2..8:
return weaponid+331;

case 9:
return 341;

case 10..15:
return weaponid+311;

case 16..18:
return weaponid+326;

case 22..29:
return weaponid+324;

case 30,31:
return weaponid+325;

case 32:
return 372;

case 33..45:
return weaponid+324;

case 46:
return 371;
}
return 0;
avatar
Versus
Fondator
Fondator

Mesaje : 151
Puncte : 448
Reputatie : 1
Data de inscriere : 11/08/2013
Localizare : constanta

Vezi profilul utilizatorului

Sus In jos

Re: Show Weapons

Mesaj Scris de SPeeDStriKe la data de Mier Aug 14, 2013 1:01 pm

Multumim !
avatar
SPeeDStriKe
Membru
Membru

Mesaje : 913
Puncte : 994
Reputatie : 13
Data de inscriere : 12/08/2013
Varsta : 23
Localizare : Bucuresti

Vezi profilul utilizatorului http://aply-zone.hitforum.ro/profile?mode=editprofile

Sus In jos

Sus


 
Permisiunile acestui forum:
Nu puteti raspunde la subiectele acestui forum