GetPlayerWeapon Help! - 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: GetPlayerWeapon Help! (
/showthread.php?tid=433205)
GetPlayerWeapon Help! -
Avi Raj - 26.04.2013
Hello,
I had this line :-
pawn Код:
if(!GetPlayerWeapon(playerid) == 6) return SendClientMessage(playerid, COLOR_YELLOW,"You need shovel to Dig Metals.");
Im Getting Error, tag mismatch.
I know if i remove '!', error will be removed but i wont that if player doesn't have shovel, then returns a message.
Any Solution for it?
Thanks.
Re: GetPlayerWeapon Help! -
Goldenfox - 26.04.2013
Try:
If(GetPlayerWeapon(playerid) != 6) return SendClientMessage(playerid, ...
Re: GetPlayerWeapon Help! -
Lordzy - 26.04.2013
Try,
pawn Код:
if(GetPlayerWeapon(playerid) != 6)
#LATE :/
Re: GetPlayerWeapon Help! -
Wesley221 - 26.04.2013
pawn Код:
if(GetPlayerWeapon(playerid) != 6) return SendClientMessage(playerid, COLOR_YELLOW,"You need shovel to Dig Metals.");
== equals, != doesnt equals
Re: GetPlayerWeapon Help! -
Avi Raj - 26.04.2013
Used my own using else.
Thanks for help.
2ND Question :-
When a player gets case this :-
pawn Код:
case 4:SetPlayerHealth(playerid, - 20) && SendClientMessageToAll(COLOR_YELLOW,"You have Been Hurted while Mining Metals.");
He gets crashed?
Why?
Re: GetPlayerWeapon Help! -
MP2 - 26.04.2013
You're setting his health to -20, not curHealth-20. Plus you can't have multiple statements after each case in a switch, and && isn't used for multiple functions on a line..
pawn Код:
case 4:
{
new Float:curPlayerHealth;
GetPlayerHealth(playerid, curPlayerHealth);
SetPlayerHealth(playerid, curPlayerHealth - 20);
SendClientMessage(playerid, COLOR_YELLOW,"You have been hurt while mining metal.");
}
Also 'You have
been hurted' isn't proper English. 'been' is past tense (as opposed to be and being) so you don't need to say 'hurted' (past tense also). Also you're using SendClientMessageToALL..
Re: GetPlayerWeapon Help! -
Avi Raj - 26.04.2013
Thanks Guys.
Repped.