#1

Код:
if(strcmp(cmd, "/duty", true) == 0)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
if(gTeam[playerid] != 2 || PlayerInfo[playerid][pService] == 11 || PlayerInfo[playerid][pJob] != 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "You are neither a Cop not a Taxi Driver!");
return 1;
}
if (PlayerInfo[playerid][pJob] == 1)
{
if (IsATaxi(GetPlayerVehicleID(playerid)))
{
if(TDuty[playerid] == 1)
{
SendClientMessage(playerid, COLOR_GREEN, "Taxi: You are now off duty!");
TDuty[playerid] = 0;
return 1;
}
if(GetTickCount() - TDutyT[playerid] < 60000)
{
SendClientMessage(playerid, COLOR_RED, "ERROR: You can only go on duty once a minute!");
return 1;
}
TDuty[playerid] = 1;
TDutyT[playerid] = GetTickCount();
format(string, sizeof(string), "TAXI: Taxi Driver %s is now on duty, /call 555 for a Taxi", sendername);
SendClientMessageToAll(COLOR_GREEN, string);
printf("%s", string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, "You are not in the Taxi Compound");
return 1;
}
}
if(PlayerInfo[playerid][pService] == 11 && pduty[playerid] == 1)
{
gTeam[playerid] = 3;
SetPlayerToTeamColor(playerid);
format(string, sizeof(string), "** %s has gone off duty", sendername);
SendTeamMessage(2, TEAM_BLUE_COLOR, string);
ResetPlayerWeapons(playerid);
pduty[playerid] = 0;
printf("%s", string);
return 1;
}
else if(PlayerInfo[playerid][pService] == 11 && pduty[playerid] == 0)
{
gTeam[playerid] = 2;
SetPlayerToTeamColor(playerid);
format(string, sizeof(string), "** %s has gone on duty", sendername);
SendTeamMessage(2, TEAM_BLUE_COLOR, string);
SetPlayerSkin(playerid, 285);
pduty[playerid] = 1;
tazer[playerid] = 2;
Cuffs[playerid] = 1;
GivePlayerWeapon(playerid, 3, 1); // Batton
GivePlayerWeapon(playerid, 24, 1000); // Deagle
GivePlayerWeapon(playerid, 26, 500); // Shotgun
GivePlayerWeapon(playerid, 41, 99999); // Spray Can
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
return 1;
}
}
SendClientMessage(playerid, COLOR_GRAD2, " you are not in the PD armoury!");
{
{
{
{
SendClientMessage(playerid, COLOR_GRAD2, " you are not part of a team");
return 1;
}
}
}
}
Im getting a warning with that code;
Код:
C:\Users\iLcke\Desktop\SA-MP\gamemodes\jrp2.pwn(14234) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Its the last } in it, but, everytime i type /duty, it goes on to the next command /swat.. ideas?
Reply
#2

I'm not sure but shouldn't the last return 1; be above the last bracket thingy.
Reply
#3

pawn Код:
if (IsATaxi(GetPlayerVehicleID(playerid)))
{
if(TDuty[playerid] == 1)
{
SendClientMessage(playerid, COLOR_GREEN, "Taxi: You are now off duty!");
TDuty[playerid] = 0;
return 1;
}
if(GetTickCount() - TDutyT[playerid] < 60000)
{
SendClientMessage(playerid, COLOR_RED, "ERROR: You can only go on duty once a minute!");
return 1;
}
TDuty[playerid] = 1;
TDutyT[playerid] = GetTickCount();
format(string, sizeof(string), "TAXI: Taxi Driver %s is now on duty, /call 555 for a Taxi", sendername);
SendClientMessageToAll(COLOR_GREEN, string);
printf("%s", string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, "You are not in the Taxi Compound");
return 1;
}
}
if(PlayerInfo[playerid][pService] == 11 && pduty[playerid] == 1)
{
gTeam[playerid] = 3;
SetPlayerToTeamColor(playerid);
format(string, sizeof(string), "** %s has gone off duty", sendername);
SendTeamMessage(2, TEAM_BLUE_COLOR, string);
ResetPlayerWeapons(playerid);
pduty[playerid] = 0;
printf("%s", string);
return 1;
}
else if(PlayerInfo[playerid][pService] == 11 && pduty[playerid] == 0)
{
gTeam[playerid] = 2;
SetPlayerToTeamColor(playerid);
format(string, sizeof(string), "** %s has gone on duty", sendername);
SendTeamMessage(2, TEAM_BLUE_COLOR, string);
SetPlayerSkin(playerid, 285);
pduty[playerid] = 1;
tazer[playerid] = 2;
Cuffs[playerid] = 1;
GivePlayerWeapon(playerid, 3, 1); // Batton
GivePlayerWeapon(playerid, 24, 1000); // Deagle
GivePlayerWeapon(playerid, 26, 500); // Shotgun
GivePlayerWeapon(playerid, 41, 99999); // Spray Can
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
}
}
}
SendClientMessage(playerid, COLOR_GRAD2, " you are not in the PD armoury!");
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " you are not part of a team");
return 1;
}
//}}}}
Reply
#4

bump still dont work
Reply
#5

another bump
Reply
#6

woah woah woah, don't comment the last set of brackets, just move "return 1" so its before the last one.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)