dcmd_robbank(playerid, params[])
{
if(PlayerInfo[playerid][pLevel] < 2) return SendClientMessage(playerid, -1, "You need to be at least Level 3!");
if(!IsPlayerInRangeOfPoint(playerid, 2, 345.585968, 112.513107, 1008.184448) return SendClientMessage(playerid, -1, "You're not at the Robbing Point!");
if(IsACop(playerid)) return SendClientMessage(playerid, -1, "Cops cannot rob the bank!");
new Cops = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsACop(i))
{
Cops += 1;
}
}
if(!(Cops >= 2))
{
SendClientMessage(playerid,COLOR_GREY,"There must be at least 2 Law Enforcement Officials online.");
return 1;
}
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
SendClientMessageToAll(COLOR_LIGHTBLUE, "The Los Santos City bank is being robbed!");
return 1;
}
At what point does it "do nothing"? Try adding prints to determine that if you do not already know, that's the easiest way to find the line with the problem on it.
|
It does nothing right at the start, if I'm lower then Level 2 it doesn't send me the return message for that.
|
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;
}
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_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;
}
Interesting, can I see where you've put the other part of the dcmd command in OnPlayerCommandText?
|
dcmd(oprison, 7, cmdtext);
//dcmd(ouninvite, 9, cmdtext);
dcmd(unban, 5, cmdtext);
dcmd(banaccount, 10, cmdtext);
dcmd(setaccent, 9, cmdtext);
dcmd(deleteaccount, 13, cmdtext);
dcmd(duel, 4, cmdtext);
dcmd(report, 6, cmdtext);
pawn Код:
|
Of course that's why silly
![]() |