03.11.2012, 05:14
So i have a command, It works perfectly (Although i get 2 warnings, Tags mismatch or something).
Then i decided to add something to it, so that people can only do it in the locker room.
This is the original command that works with 2 warnings
.
This is what i changed it too
I'm fully aware that what i changed it too probably looks wrong as fuck, i'm new to scripting and I thought i'd try to add something with watching a tut or anything, If someone could help that'd be nice, i forgot to get the error code, if you need it, ask for it in the replies.
Then i decided to add something to it, so that people can only do it in the locker room.
This is the original command that works with 2 warnings
Код:
command(badge, playerid, params[]) { if (Player[playerid][Group] == 1) { new string[128]; switch(Player[playerid][pBadge]) { case 0: { Player[playerid][pBadge] = 1; format(string, sizeof(string), "* %s snaps on their badge", GetName(playerid)); NearByMessage(playerid, NICESKY, string); SendClientMessage(playerid, WHITE, "You are now on duty"); Player[playerid][CopDuty] = 1; SetPlayerColor(playerid, BLUE); Player[playerid][Ranks] = Rank5; SetPlayerSkin(playerid, 288); GivePlayerWeapon(playerid, 24, 200); } case 1: { Player[playerid][pBadge] = 0; format(string, sizeof(string), "* %s snaps off their badge", GetName(playerid)); NearByMessage(playerid, NICESKY, string); Player[playerid][CopDuty] = 0; SendClientMessage(playerid, WHITE, "You are now off duty"); SetPlayerColor(playerid, WHITE); SetPlayerSkin(playerid, Player[playerid][LastSkin]); ResetPlayerWeapons(playerid); } } } return 1; }
This is what i changed it too
Код:
command(badge, playerid, params[]) { if (Player[playerid][Group] == 1) { new string[128]; switch(Player[playerid][pBadge]) { case 0: { if(IsPlayerInRangeOfPoint(playerid, 4.0, 264.24, 109.34, 1004.62)){ { Player[playerid][pBadge] = 1; format(string, sizeof(string), "* %s snaps on their badge", GetName(playerid)); NearByMessage(playerid, NICESKY, string); SendClientMessage(playerid, WHITE, "You are now on duty"); Player[playerid][CopDuty] = 1; SetPlayerColor(playerid, BLUE); Player[playerid][Ranks] = Rank5; SetPlayerSkin(playerid, 288); GivePlayerWeapon(playerid, 24, 200); } else SendClientMessage(playerid, WHITE, "You need to be in the locker rooms to do this command!"); } case 1: { Player[playerid][pBadge] = 0; format(string, sizeof(string), "* %s snaps off their badge", GetName(playerid)); NearByMessage(playerid, NICESKY, string); Player[playerid][CopDuty] = 0; SendClientMessage(playerid, WHITE, "You are now off duty"); SetPlayerColor(playerid, WHITE); SetPlayerSkin(playerid, Player[playerid][LastSkin]); ResetPlayerWeapons(playerid); } } } return 1; }