Suppressor System
#1

So I'm new to the whole scripting in pawn and I'm trying to make some sort of suppressor system. It'll start with getting a colt 45, then I want to buy a suppressor (an object that actually doesn't exist) and attach it to the gun, replacing the colt 45 with a silenced weapon.

This is what I've got so far:

CMD:usp(playerid, params[])
{
GivePlayerWeapon(playerid, 22, 10);
SendClientMessage(playerid, COLOR_AQUA, "You have been given a Colt 45");
return 1;
Reply
#2

for first, take care of brackets.
PHP код:
CMD:usp(playeridparams[])
{
    
GivePlayerWeapon(playerid2210);
    
SendClientMessage(playeridCOLOR_AQUA"You have been given a Colt 45");
    return 
1;

you must replace Colt45 with SDColt45. you can simply make this replacement with giving the player weapon ID 23 (for example - GivePlayerWeapon(playerid, 23, 0);)
Reply
#3

Quote:
Originally Posted by Mugala
Посмотреть сообщение
for first, take care of brackets.
PHP код:
CMD:usp(playeridparams[])
{
    
GivePlayerWeapon(playerid2210);
    
SendClientMessage(playeridCOLOR_AQUA"You have been given a Colt 45");
    return 
1;

you must replace Colt45 with SDColt45. you can simply make this replacement with giving the player weapon ID 23 (for example - GivePlayerWeapon(playerid, 23, 0);)
Yes, I know, I just didn't bother to copy all of it.

I also know that you can change the ID to the SD pistol one, but that's not what I'm asking. I want to make a system that includes making a silenced pistol only if you have a colt 45 and a suppressor in your characters data.
Reply
#4

Just check if player is holding colt 45 and check if he has suppressor then give silenced, what's the problem?
Reply
#5

Quote:
Originally Posted by David (Sabljak)
Посмотреть сообщение
Just check if player is holding colt 45 and check if he has suppressor then give silenced, what's the problem?
The problem is that I don't know how to do it
Reply
#6

Quote:
Originally Posted by Mo123
Посмотреть сообщение
The problem is that I don't know how to do it
PHP код:
if(GetPlayerWeapon(playerid) == weaponid//change weapon id to colt id 
Reply
#7

Quote:
Originally Posted by Lokii
Посмотреть сообщение
PHP код:
if(GetPlayerWeapon(playerid) == weaponid//change weapon id to colt id 
That's not what I mean. I want to create a suppressor (an item that actually doesnt exist) and use that and the colt 45 to create a USP.
Reply
#8

PHP код:
new HasSupp[MAX_PLAYERS]; // on top of the script.
OnPlayerConnect(playerid)
{
    
HasSupp[playerid] = 0;
    return 
1;
}
OnPlayerDisconnect(playerid)
{
    
HasSupp[playerid] = 0;
    return 
1;
}
CMD:suppressor(playeridparams[])
{
    
SendClientMessage(playeridCOLOR_AQUA"You have been given a suppressor");
    
HasSupp[playerid] = 1;
    return 
1;
}
CMD:attachsupp(playeridparams[])
{
    if(
HasSupp[playerid] == 0) return SendClientMessage(playeridCOLOR_AQUA"You don't have a suppressor");
    if(
GetPlayerWeapon(playerid) == 22)
    {
        
GivePlayerWeapon(playerid23100);
        
GivePlayerWeapon(playerid220);
     }
     
SendClientMessage(playeridCOLOR_AQUA"Attached the suppressor!");
     else {
     
SendClientMessage(playeridCOLOR_AQUA"You don't have a colt 45"); }
     return 
1;

Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)