SA-MP Forums Archive
Tazer problem - 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: Tazer problem (/showthread.php?tid=463916)



Tazer problem - xdarren - 14.09.2013

Код:
 if(newkeys & KEY_LOOK_BEHIND && IsPlayerENF(playerid) && !IsPlayerInAnyVehicle(playerid) && PlayerTemp[playerid][isevent] == 0)
    {
        if(GetPVarInt(playerid, "Tazer") == 1)
        {
            //GivePlayerWeapon(playerid, 24, GetPVarInt(playerid, "Tazer"));
            SetPVarInt(playerid, "Tazer", 0);
            RemovePlayerAttachedObject(playerid, 0);
		   	Action(playerid, "puts his tazer back into his belt.");
		   	return 1;
        }

        SetPVarInt(playerid, "Tazer", 1);
        SetPlayerAttachedObject(playerid, 0, 18642, 6, 0.06, 0.01, 0.08, 180.0, 0.0, 0.0);
        //GivePlayerWeapon(playerid, 23, 10);
		Action(playerid, "takes his tazer out of his belt.");
        return 1;
    }
This was getting on my nerves all night, how do I re-create this to get Silenced Pistol as a tazer isntead of having meele tazer in hand. And that I will make command that when I have deagle in my hand and write /tazer that it will swtich to SD Pistol as tazer and /tazaer again to swtich it back to deagle.


Re: Tazer problem - Mark_Samp - 14.09.2013

You need to add a function to replace your tazer with your Silence Pistol for example :

PHP код:
new pTazerReplace[MAX_PLAYERS]; 
Define that up

Now you made a define , now go under :

PHP код:
public OnPlayerStateChange(playeridnewstateoldstate
Then put that :

PHP код:
if((newstate == || newstate == || newstate == || newstate == 9) && pTazer[playerid] == 1)
    {
        
RemovePlayerWeapon(playerid23);
        
GivePlayerWeapon(playeridpTazerReplace[playerid], 60000);
        
pTazer[playerid] = 0;
    } 
Now on your tazer command add under :
PHP код:
if(GetPVarInt(playerid"Tazer") == 1
add that :
PHP код:
pTazerReplace[playerid] = PlayerInfo[playerid][pGuns][2];
if(
PlayerInfo[playerid][pGuns][2] != 0RemovePlayerWeapon(playeridPlayerInfo[playerid][pGuns][2]);
GivePlayerValidWeapon(playerid2360000);
Action(playerid"takes his tazer out of his belt.");
pTazer[playerid] = 1
Now lets add when you type /tazer again it holster the tazer

PHP код:
        }
        else
        { 
PHP код:
RemovePlayerWeapon(playerid23);
GivePlayerValidWeapon(playeridpTazerReplace[playerid], 60000);
Action(playerid"puts his tazer back into his belt.");
pTazer[playerid] = 0
Now add under :

PHP код:
public OnPlayerConnect(playerid
PHP код:
pTazerReplace[playerid] = 0
That's will define when the player connects to the server it will set his tazer to 0

Now add under :

PHP код:
public OnPlayerDisconnect(playeridreason
PHP код:
if(pTazer[playerid] == 1GivePlayerValidWeapon(playerid,pTazerReplace[playerid],60000); 
I hope that I helped if you need any question just ask here


Re: Tazer problem - xdarren - 14.09.2013

error 017: undefined symbol "pTazer" what now ?


Re: Tazer problem - Nothis - 14.09.2013

Quote:
Originally Posted by xdarren
Посмотреть сообщение
error 017: undefined symbol "pTazer" what now ?
You Need To
Код:
#define ptazer
It Will Work Now.


Re: Tazer problem - Nothis - 14.09.2013

Quote:
Originally Posted by xdarren
Посмотреть сообщение
error 017: undefined symbol "pTazer" what now ?
Open Pawno , Then F2 (or find) Write In The Search Tab define
add under or over any define line
Код:
#define ptazer
Then Click F5 or click on compile then open your samp-server.exe
Hope It Works


Re: Tazer problem - Mark_Samp - 14.09.2013

Quote:
Originally Posted by Nothis
Посмотреть сообщение
You Need To
Код:
#define ptazer
It Will Work Now.
Yea you also need to define same things I did :

PHP код:
public OnPlayerConnect(playerid
PHP код:
pTazer[playerid] = 0
PHP код:
public OnPlayerDeath(playeridkilleridreason
PHP код:
pTazer[playerid] = 0
PHP код:
public OnPlayerDisconnect(playeridreason
PHP код:
pTazer[playerid] = 0