09.08.2011, 10:33
im trying to use the command /ticket and it seems it aint working and i dont understand whats wrong,heres the code
it says "you are not a cop" even if im on or off duty ,any idea?
edit : the gov command says the same thing,but i think ill be able to fix it if you can help me with the one above
i'll also add 1 more thing here so i dont open another topic,when the suspect is killed,as a cop,i dont get the money and the suspect doesnt go to jail
thx in advance
pawn Код:
if(strcmp(cmd, "/ticket", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gTeam[playerid] != 2)
{
SCM(playerid, COLOR_GREY, " You are not a Cop!");
return 1;
}
if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1)
{
SCM(playerid, COLOR_GREY, " You are not on Duty!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SCM(playerid, COLOR_GRAD2, "USAGE: /ticket [playerid/PartOfName] [price] [reason]");
return 1;
}
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SCM(playerid, COLOR_GRAD2, "USAGE: /ticket [playerid/PartOfName] [price] [reason]");
return 1;
}
moneys = strval(tmp);
if(moneys < 1 || moneys > 99999) { SCM(playerid, COLOR_GREY, " Ticket Money can't be below 1 or higher then 99999 !"); return 1; }
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SCM(playerid, COLOR_GRAD2, "USAGE: /ticket [playerid/PartOfName] [price] [reason]");
return 1;
}
format(string, sizeof(string), "* You gave %s a Ticket costing $%d, reason: %s", giveplayer, moneys, (result));
SCM(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Officer %s has given you a Ticket costing $%d, reason: %s", sendername, moneys, (result));
SCM(giveplayerid, COLOR_LIGHTBLUE, string);
SCM(giveplayerid, COLOR_LIGHTBLUE, "* Type /accept ticket, to accept it.");
TicketOffer[giveplayerid] = playerid;
TicketMoney[giveplayerid] = moneys;
return 1;
}
else
{
SCM(playerid, COLOR_GREY, " That player is not near you !");
return 1;
}
}
}
else
{
SCM(playerid, COLOR_GREY, " That player is Offline !");
return 1;
}
}
return 1;
}
it says "you are not a cop" even if im on or off duty ,any idea?
edit : the gov command says the same thing,but i think ill be able to fix it if you can help me with the one above
i'll also add 1 more thing here so i dont open another topic,when the suspect is killed,as a cop,i dont get the money and the suspect doesnt go to jail
pawn Код:
if(newstate == PLAYER_STATE_WASTED)
{
if(WantedLevel[playerid] >= 1)
{
new price = WantedLevel[playerid] * 500;
new count;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(gTeam[i] == 2 && CrimInRange(30.0, playerid,i))
{
count = 1;
format(string, sizeof(string), "~w~Running Suspect~r~Killed~n~Bonus~g~$%d", price);
GameTextForPlayer(i, string, 5000, 1);
ConsumingMoney[i] = 1;
GivePlayerMoney(i, price / 2);
PlayerPlaySound(i, 1058, 0.0, 0.0, 0.0);
}
}
}
if(count == 1)
{
PlayerInfo[playerid][pMats] = 0;
GivePlayerMoney(playerid, - price);
PlayerInfo[playerid][pWantedDeaths] += 1;
PlayerInfo[playerid][pJailed] = 1;
PlayerInfo[playerid][pJailTime] = (WantedLevel[playerid])*(300);
SetPlayerWantedLevel(playerid, 0);
format(string, sizeof(string), "* You are in Jail for %d Seconds and lose $%d because of running away and getting shot by the Officer.", PlayerInfo[playerid][pJailTime], price);
SCM(playerid, COLOR_LIGHTRED, string);
WantedPoints[playerid] = 0;
WantedLevel[playerid] = 0;
}
}
}
thx in advance