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(playerid, newstate, oldstate)
Then put that :
PHP код:
if((newstate == 2 || newstate == 3 || newstate == 7 || newstate == 9) && pTazer[playerid] == 1)
{
RemovePlayerWeapon(playerid, 23);
GivePlayerWeapon(playerid, pTazerReplace[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] != 0) RemovePlayerWeapon(playerid, PlayerInfo[playerid][pGuns][2]);
GivePlayerValidWeapon(playerid, 23, 60000);
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 код:
RemovePlayerWeapon(playerid, 23);
GivePlayerValidWeapon(playerid, pTazerReplace[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(playerid, reason)
PHP код:
if(pTazer[playerid] == 1) GivePlayerValidWeapon(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
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
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
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(playerid, killerid, reason)
PHP код:
pTazer[playerid] = 0;
PHP код:
public OnPlayerDisconnect(playerid, reason)
PHP код:
pTazer[playerid] = 0;