GetPlayerWeapon Help!
#1

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.
Reply
#2

Try:
If(GetPlayerWeapon(playerid) != 6) return SendClientMessage(playerid, ...
Reply
#3

Try,
pawn Код:
if(GetPlayerWeapon(playerid) != 6)
#LATE :/
Reply
#4

pawn Код:
if(GetPlayerWeapon(playerid) != 6) return SendClientMessage(playerid, COLOR_YELLOW,"You need shovel to Dig Metals.");
== equals, != doesnt equals
Reply
#5

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?
Reply
#6

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..
Reply
#7

Thanks Guys.
Repped.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)