Suppressor System - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Suppressor System (
/showthread.php?tid=654383)
Suppressor System -
Mo123 - 27.05.2018
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;
Re: Suppressor System -
Mugala - 28.05.2018
for first, take care of brackets.
PHP код:
CMD:usp(playerid, params[])
{
GivePlayerWeapon(playerid, 22, 10);
SendClientMessage(playerid, COLOR_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);)
Re: Suppressor System -
Mo123 - 28.05.2018
Quote:
Originally Posted by Mugala
for first, take care of brackets.
PHP код:
CMD:usp(playerid, params[])
{
GivePlayerWeapon(playerid, 22, 10);
SendClientMessage(playerid, COLOR_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.
Re: Suppressor System -
David (Sabljak) - 28.05.2018
Just check if player is holding colt 45 and check if he has suppressor then give silenced, what's the problem?
Re: Suppressor System -
Mo123 - 28.05.2018
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
Re: Suppressor System -
Lokii - 28.05.2018
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
Re: Suppressor System -
Mo123 - 28.05.2018
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.
Re: Suppressor System -
Exhibit - 28.05.2018
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(playerid, params[])
{
SendClientMessage(playerid, COLOR_AQUA, "You have been given a suppressor");
HasSupp[playerid] = 1;
return 1;
}
CMD:attachsupp(playerid, params[])
{
if(HasSupp[playerid] == 0) return SendClientMessage(playerid, COLOR_AQUA, "You don't have a suppressor");
if(GetPlayerWeapon(playerid) == 22)
{
GivePlayerWeapon(playerid, 23, 100);
GivePlayerWeapon(playerid, 22, 0);
}
SendClientMessage(playerid, COLOR_AQUA, "Attached the suppressor!");
else {
SendClientMessage(playerid, COLOR_AQUA, "You don't have a colt 45"); }
return 1;
}