Quote:
Originally Posted by JaTochNietDan
Well for one thing that color doesn't look very valid, -1? What color are you intending it to be? It should be in hex format, but all I see is a negative integer, which seems a little odd, I don't know what kind of results that would turn up, but I would suggest using the function as it's intended to be used!
Anyway, I'm pretty sure it'll do something if it's called, so lets add some prints to debug it like I stated earlier, I'll help you add them:
pawn Код:
dcmd_robbank(playerid, params[]) { print("Success 1"); if(PlayerInfo[playerid][pLevel] < 2) return SendClientMessage(playerid, -1, "You need to be at least Level 3!"); print("Success 2"); if(!IsPlayerInRangeOfPoint(playerid, 2, 345.585968, 112.513107, 1008.184448) return SendClientMessage(playerid, -1, "You're not at the Robbing Point!"); print("Success 3"); if(IsACop(playerid)) return SendClientMessage(playerid, -1, "Cops cannot rob the bank!"); new Cops = 0; print("Success 4"); for(new i = 0; i < MAX_PLAYERS; i++) if(IsACop(i)) Cops += 1; print("Success 5"); if(!(Cops >= 2)) { print("Success 6"); SendClientMessage(playerid,COLOR_GREY,"There must be at least 2 Law Enforcement Officials online."); return 1; } print("Success 7"); //new sendername[MAX_PLAYER_NAME]; - Pointless? Never used in this snippet! //GetPlayerName(playerid, sendername, sizeof(sendername)); - Pointless? Never used in this snippet! SendClientMessageToAll(COLOR_LIGHTBLUE, "The Los Santos City bank is being robbed!"); return 1; }
Give that a run and tell me exactly what it prints out (I've also cleaned up your code a little as it was kind of hard to read!)
|
I have "-1" on other commands and it works, it makes the color white for some unknown reason and it's quicker then putting COLOR_WHITE or anything. So, I tried your code, and again, it does nothing (prints nothing). A code above it (that works fine) might be making it not work, so here's the code above it including the robbank code:
pawn Код:
dcmd_report(playerid, params[])
{
new target, msg[128], tString[128];
if(sscanf(params, "us[128]", target, msg)) return SendClientMessage(playerid, -1, "How to report: /report [admin name] [message]");
if(JustReported[playerid] == 1) return SendClientMessage(playerid, -1, "You must wait 10 seconds to report again!");
if(!IsPlayerConnected(target)) return SendClientMessage(playerid, -1, "That Admin is not online!");
if(PlayerInfo[target][pAdmin] <=1) return SendClientMessage(playerid, -1, "That person is not an Admin!");
//If all above checks out, the code below will execute
JustReported[playerid] = 1;
SetTimerEx("ReportReset", 10000, false, "i", playerid);
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(tString, sizeof(tString), "{CC1100}Report from {FFFFFF}[%d]%s: %s", playerid, sendername, msg);
SendClientMessage(target,-1,tString);
SendClientMessage(playerid, COLOR_YELLOW, "Report sent. Administrator will reply shortly.");
return 1;
}
dcmd_robbank(playerid, params[])
{
print("Success 1");
if(PlayerInfo[playerid][pLevel] < 2) return SendClientMessage(playerid, COLOR_WHITE, "You need to be at least Level 3!");
print("Success 2");
if(!IsPlayerInRangeOfPoint(playerid, 2, 345.585968, 112.513107, 1008.184448) return SendClientMessage(playerid, COLOR_WHITE, "You're not at the Robbing Point!");
print("Success 3");
if(IsACop(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "Cops cannot rob the bank!");
new Cops = 0;
print("Success 4");
for(new i = 0; i < MAX_PLAYERS; i++)
if(IsACop(i)) Cops += 1;
print("Success 5");
if(!(Cops >= 2))
{
SendClientMessage(playerid,COLOR_GREY,"There must be at least 2 Law Enforcement Officials online.");
return 1;
}
print("Success 6");
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
SendClientMessageToAll(COLOR_LIGHTBLUE, "The Los Santos City bank is being robbed!");
return 1;
}