No, you DON'T! You want everything done FOR you. I wrote a holstering script for this guy from scratch and tested it myself to make sure it worked before sending it.
His gamemode (NGG-edit) blocked it because of the anti cheat and after preempetive attempts to remove it (by myself) I gave up because all of them were unsuccessful.
He ignored any advice I gave, esp. the advice to avoid NGG scripts and to use a user friendly one.
pawn Код:
// Mione - http://forum.sa-mp.com/member.php?u=202420#include <a_samp>#include <sscanf2>#include <zcmd>new bool: pHolster
[MAX_PLAYERS
];
new pHolsteredWeapon
[MAX_PLAYERS
];
new pHolsteredAmmo
[MAX_PLAYERS
];
CMD:ps
(playerid, params
[]){ new sel
[20], string
[50], gunname
[24];
GetWeaponName
(GetPlayerWeapon
(playerid
), gunname,
sizeof(gunname
));
if(sscanf
(params,
"s[20]", sel
)) return SendClientMessage
(playerid,
-1,
"/ps [back]");
if(pHolster
[playerid
]) return SendClientMessage
(playerid,
-1,
"You already have something holstered on your back! (/pt)");
if(GetPlayerWeapon
(playerid
) == 0) return SendClientMessage
(playerid,
-1,
"You don't have a weapon!");
if(GetPlayerWeapon
(playerid
) == 29 || GetPlayerWeapon
(playerid
) == 31 || GetPlayerWeapon
(playerid
) == 34 || GetPlayerWeapon
(playerid
) == 25 || GetPlayerWeapon
(playerid
) == 27) { if(!strcmp(sel,
"back")) { pHolster
[playerid
] = true;
pHolsteredWeapon
[playerid
] = GetPlayerWeapon
(playerid
);
pHolsteredAmmo
[playerid
] = GetPlayerAmmo
(playerid
);
format(string,
sizeof(string
),
"You have holstered your %s! Use /pt to restore it!", gunname
);
SendClientMessage
(playerid,
-1, string
);
HolsterObject
(playerid, pHolsteredWeapon
[playerid
]);
RemovePlayerWeapon
(playerid, GetPlayerWeapon
(playerid
));
} } else SendClientMessage
(playerid,
-1,
"You can't holster this type of weapon!");
return 1;
}CMD:holstered
(playerid, params
[]){ new string
[75], gunname
[24];
GetWeaponName
(pHolsteredWeapon
[playerid
], gunname,
sizeof(gunname
));
if(pHolsteredWeapon
[playerid
] == 0) gunname
= "None";
format(string,
sizeof(string
),
"Weapon: %s with %d ammo.", gunname, pHolsteredAmmo
[playerid
]);
SendClientMessage
(playerid,
-1, string
);
return 1;
}CMD:pt
(playerid, params
[]){ new sel
[20], string
[50], gunname
[24];
GetWeaponName
(pHolsteredWeapon
[playerid
], gunname,
sizeof(gunname
));
if(sscanf
(params,
"s[20]", sel
)) return SendClientMessage
(playerid,
-1,
"/pt [back]");
if(!pHolster
[playerid
]) return SendClientMessage
(playerid,
-1,
"You don't have anything in your holster!");
if(!strcmp(sel,
"back")) { pHolster
[playerid
] = false;
pHolsteredWeapon
[playerid
] = 0;
pHolsteredAmmo
[playerid
] = 0;
GivePlayerWeapon
(playerid, pHolsteredWeapon
[playerid
], pHolsteredAmmo
[playerid
]);
RemovePlayerAttachedObject
(playerid,
8);
format(string,
sizeof(string
),
"You have unholstered your %s! Use /ps to holster it!", gunname
);
SendClientMessage
(playerid,
-1, string
);
} return 1;
}forward HolsterObject
(playerid, weaponid
);
public HolsterObject
(playerid, weaponid
){ if(weaponid
== 29) SetPlayerAttachedObject
(playerid,
8,
353,
1,
-0.059,
-0.1189,
0.079,
0.0,
62.599,
0.0,
1.0,
1.0,
1.0);
// mp5 if(weaponid
== 31) SetPlayerAttachedObject
(playerid,
8,
356,
1,
-0.059,
-0.1189,
0.079,
0.0,
35.098,
0.0,
1.0,
1.0,
1.0);
// m4 if(weaponid
== 34) SetPlayerAttachedObject
(playerid,
8,
358,
1,
-0.059,
-0.1189,
0.079,
0.0,
35.098,
0.0,
1.0,
1.0,
1.0);
// sniper if(weaponid
== 25) SetPlayerAttachedObject
(playerid,
8,
349,
1,
-0.194,
-0.1185,
0.195,
0.0,
60.998,
0.0,
1.0,
1.0,
1.0);
// shotgun if(weaponid
== 27) SetPlayerAttachedObject
(playerid,
8,
351,
1,
-0.194,
-0.1185,
0.195,
0.0,
60.998,
0.0,
1.0,
1.0,
1.0);
// combat shotgun return true;
}stock RemovePlayerWeapon
(playerid, weaponid
){ new plyWeapons
[12], plyAmmo
[12], wep, ammo;
for(new slot
= 0; slot
!= 12; slot
++) { GetPlayerWeaponData
(playerid, slot, wep, ammo
);
if(wep
!= weaponid
) { GetPlayerWeaponData
(playerid, slot, plyWeapons
[slot
], plyAmmo
[slot
]);
} } ResetPlayerWeapons
(playerid
);
for(new slot
= 0; slot
!= 12; slot
++) { GivePlayerWeapon
(playerid, plyWeapons
[slot
], plyAmmo
[slot
]);
} return true;
}