replace tazer - 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: replace tazer (
/showthread.php?tid=374669)
replace tazer -
Why - 03.09.2012
Hello, I am making a roleplay server and I'm currently scripting a tazer.
However, when I withdraw a tazer it will replace the current gun(pistol) with a sdpistol. When I holster it, I planned to make it so it would give the tazer back, however I only get weapon 0 back.
This is my code:
pawn Код:
CMD:tazer(playerid, params[])
{
new replace;
if(tazer[playerid] == 0)
{
replace = PlayerInfo[playerid][pGuns][2];
GivePlayerValidWeapon(playerid, 23, 9999);
tazer[playerid] = 1;
new string[56];
format(string, sizeof(string), "* %s unholsters his tazer.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE);
return 1;
}
if(tazer[playerid] == 1)
{
tazer[playerid] = 0;
new string[56];
GivePlayerValidWeapon(playerid, replace, 6000);
format(string, sizeof(string), "* %s holsters his tazer. (debug %i)", GetPlayerNameEx(playerid), replace);
ProxDetector(30.0, playerid, string, COLOR_PURPLE);
return 1;
}
return 1;
}
Re: replace tazer -
rBcollo - 03.09.2012
Try this code:
pawn Код:
CMD:tazer(playerid, params[])
{
if(tazer[playerid] == 0)
{
GivePlayerValidWeapon(playerid, 23, 9999);
tazer[playerid] = 1;
new string[56];
format(string, sizeof(string), "* %s unholsters his tazer.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE);
return 1;
}
if(tazer[playerid] == 1)
{
tazer[playerid] = 0;
new string[56];
GivePlayerValidWeapon(playerid, 22, 6000);
format(string, sizeof(string), "* %s holsters his tazer. ", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE);
return 1;
}
return 1;
}
Re: replace tazer -
Why - 03.09.2012
Quote:
Originally Posted by rBcollo
Try this code:
pawn Код:
CMD:tazer(playerid, params[]) { if(tazer[playerid] == 0) { GivePlayerValidWeapon(playerid, 23, 9999); tazer[playerid] = 1; new string[56]; format(string, sizeof(string), "* %s unholsters his tazer.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE); return 1; } if(tazer[playerid] == 1) { tazer[playerid] = 0; new string[56]; GivePlayerValidWeapon(playerid, 22, 6000); format(string, sizeof(string), "* %s holsters his tazer. ", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE); return 1; } return 1; }
|
This wont help at all, because 22 is Colt 45, and it'd suck if I replace my Deagle with a tazer and get a colt 45 in return when you holster it. All I am askin is what is wrong with my code.
Re: replace tazer -
Why - 03.09.2012
solved it myself.