26.04.2010, 04:19
Heres the code.
Now what problem is that when i type /detain without an id, it displays the [else return SendClientMessage(playerid, COLOR_LIME, "Only Police Officers can use this command.");] line instead of the [SendClientMessage(playerid, COLOR_WHITE, "USAGE: /detain [ID]");] line. But other than that, the detain works. When i type /kidnap how ever, it shows the [else return SendClientMessage(playerid, COLOR_LIME, "Only Police Officers can use this command.");] line, not the [else return SendClientMessage(playerid, COLOR_LIME, "Only Criminals can use this command.");] line.
What am i missing to get this to work properly?
Quote:
if(strcmp(cmd, "/detain", true)==0) { if (gTeam[playerid] == TEAM_COP) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /detain [ID]"); return 1; } new pid = strval(tmp); if(GetDistanceBetweenPlayers(playerid,pid) > 5) return SendClientMessage(playerid, COLOR_LIME, "You need to be with in 5 feet of your suspect to detain."); if (IsPlayerConnected(pid)) { new vehicleid; vehicleid = GetPlayerVehicleID(playerid); PutPlayerInVehicle(pid,vehicleid,3); TogglePlayerControllable(playerid,0); SendClientMessage(pid, COLOR_WHITE, "You have been detained by a Police Officer"); } } else return SendClientMessage(playerid, COLOR_LIME, "Only Police Officers can use this command."); return 1; } if(strcmp(cmd, "/kidnap", true)==0) { if (gTeam[playerid] == TEAM_CRIMINAL) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /kidnap [ID]"); return 1; } new pid = strval(tmp); if(GetDistanceBetweenPlayers(playerid,pid) > 5) return SendClientMessage(playerid, COLOR_LIME, "You need to be with in 5 feet of your target to kidnap"); if (IsPlayerConnected(pid)) { new vehicleid; vehicleid = GetPlayerVehicleID(playerid); PutPlayerInVehicle(pid,vehicleid,3); TogglePlayerControllable(playerid,0); SendClientMessage(pid, COLOR_WHITE, "You have been kidnapped!"); } } else return SendClientMessage(playerid, COLOR_LIME, "Only Criminals can use this command."); return 1; } |
What am i missing to get this to work properly?