PDA

View Full Version : Wanted Level (+REP)


Trynda
22/05/2014, 12:27 PM
Hi there!

Good Day

How do i make the player wanted level on 3 when they attempting to rob the bank and make the wanted level to 6 when they finished robbing the bank. And also it should be shown in /wanted list (for cops)

public robtimer(playerid)
{
new string[128];//We are defining a new string for the formatted message that we are displaying later on.
new cash = random(2000000);
GivePlayerMoney(playerid, cash);
/*
With the fuction above 'new cash = random(200000);
GivePlayerMoney(playerid, cash);' we give the player
a random amount of money from $0 - $200,000
*/
//Here below we use the string we defined above to format the message itself and display it to the player.
format(string, sizeof(string), "You have successfully robbed $%d from the bank!", cash);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "[BREAKING NEWS] The suspect %s has successfully rob the money bank", GetPlayerNameEx(playerid));
SendClientMessageToAll(0x008000FF, string);

}

CMD:robbank(playerid, params[])
{
if(robpossible == 1) //If the bank can be robbed we continue below
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, 2319.2310,-2.0349,26.7496))
{//Next thing we do is, we check if we are at the bank interior ^^
robpossible = 0; //Then we set the bank so it cannot be robbed
SetTimer("waittimer", 900000, false); //Normal Mode 5 minutes
/*We run the timer(5 minutes) for the function that is going to make the
bank available for robbing again
*/
//SetTimer("waittimer", 65000, false); //Test Mode 65 seconds
SetTimer("robtimer", 300000, false);
/* We also run another timer(1 minute) for the function that is
actually going to give us the money and a user friendly message.
*/
/*
Add a function that would notify the police.
*/

SendClientMessageToAll(0x00FF00FF,"[BREAKING NEWS] Bank is being robbed, do not come near the bank!");
SendClientMessageToAll(0x0080FFFF, "Alerting all POLICE to come at bank As Soon as possible!!!");
SendClientMessageToAll(0x0080FFFF, "Lahat ng police PUMUNTA sa BANK Ngayon din!!!");

SendClientMessage(playerid, 0xFF0000FF, "You are robbing the bank, the police has been notified!");
SendClientMessage(playerid, 0x008000FF, "You gotta stay 5 minutes before you get the moneys!!!");


} else return SendClientMessage(playerid, COLOR_WHITE, "You are not in BANK SAFE!!");
} else {
SendClientMessage(playerid, COLOR_WHITE, "You can't rob the bank right now! Already rob or waiting for cool down");
}
return 1;
}


CMD:wanted(playerid, params[])
{
if(IsACop(playerid) || IsInLSFMD(playerid) || PlayerInfo[playerid][pJob] == 2 || PlayerInfo[playerid][pJob2] == 2 || PlayerInfo[playerid][pFaction] == 5 && PlayerInfo[playerid][pDivision] == 5 || PlayerInfo[playerid][pFaction] == 5 && PlayerInfo[playerid][pDivision] == 2)
{
new string[128], x;

SendClientMessage(playerid, COLOR_GREEN, "Current Wanted Suspects:");
foreach(Player, i)
{
if(PlayerInfo[i][pWantedLevel] >= 1)
{
format(string, sizeof(string), "%s%s: %d", string,GetPlayerNameEx(i),PlayerInfo[i][pWantedLevel]);
x++;
if(x > 3) {
SendClientMessage(playerid, COLOR_YELLOW, string);
x = 0;
format(string, sizeof(string), " ");
} else {
format(string, sizeof(string), "%s, ", string);
}
}
}
if(x <= 3 && x > 0)
{
string[strlen(string)-2] = '.';
SendClientMessage(playerid, COLOR_YELLOW, string);
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You're not a Lawyer / Cop / FBI!");
}
return 1;
}


Others CMD that make player shown in /wanted list

CMD:su(playerid, params[]) {
if(IsACop(playerid) || PlayerInfo[playerid][pFaction] == 5 && PlayerInfo[playerid][pDivision] == 5 || PlayerInfo[playerid][pFaction] == 5 && PlayerInfo[playerid][pDivision] == 2) {
if(PlayerInfo[playerid][pJailed] > 0) {
return SendClientMessage(playerid, COLOR_WHITE, "You can't use this in jail/prison.");
}

new
iTargetID,
szCrime[64];

if(sscanf(params, "us[64]", iTargetID, szCrime)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/su)spect [playerid/partofname] [crime description]");
}
else if(!IsPlayerConnected(iTargetID)) {
SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified.");
}
else if(IsACop(iTargetID)) {
SendClientMessage(playerid, COLOR_GREY, "You can't use this command on a law enforcement officer.");
}
else if(PlayerInfo[iTargetID][pFaction] == 5) {
SendClientMessage(playerid, COLOR_GREY, "This person has diplomatic immunity.");
}
else if(PlayerInfo[iTargetID][pWantedLevel] >= 6) {
SendClientMessage(playerid, COLOR_GRAD2, "Target is already most wanted.");
}
else {

new
szMessage[128];

++PlayerInfo[iTargetID][pCrimes];
SetPlayerWantedLevel(iTargetID, ++PlayerInfo[iTargetID][pWantedLevel]);
if(PlayerInfo[iTargetID][pWantedLevel] > 5)
{
SetPlayerColor(iTargetID, WANTED_COLOR);
}

format(szMessage, sizeof(szMessage), "You've commited a crime (%s), reporter: %s.", szCrime, GetPlayerNameEx(playerid));
SendClientMessage(iTargetID, COLOR_LIGHTRED, szMessage);

format(szMessage, sizeof(szMessage), "Current wanted level: %d", PlayerInfo[iTargetID][pWantedLevel]);
SendClientMessage(iTargetID, COLOR_YELLOW, szMessage);

foreach(Player, i) if(IsACop(i) || PlayerInfo[i][pFaction] == 5 && PlayerInfo[i][pDivision] == 5 || PlayerInfo[playerid][pFaction] == 5 && PlayerInfo[playerid][pDivision] == 2) {
format(szMessage, sizeof(szMessage), "HQ: All units APB (reporter: %s)",GetPlayerNameEx(playerid));
SendClientMessage(i, TEAM_BLUE_COLOR, szMessage);
format(szMessage, sizeof(szMessage), "HQ: Crime: %s, suspect: %s", szCrime, GetPlayerNameEx(iTargetID));
SendClientMessage(i, TEAM_BLUE_COLOR, szMessage);
}
}
}
else SendClientMessage(playerid, COLOR_GRAD2, "You're not a law enforcement officer.");
return 1;
}


THANK YOU VERY MUCH,

I REALLY PROMISE I WILL GIVE AN +REP TO A GUY WHO CAN HELP ME!!

Respectfully Yours,
Trynda :)

Diverse
22/05/2014, 12:36 PM
CMD:robbank(playerid, params[])
{
if(robpossible == 1) //If the bank can be robbed we continue below
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, 2319.2310,-2.0349,26.7496))
{//Next thing we do is, we check if we are at the bank interior ^^
robpossible = 0; //Then we set the bank so it cannot be robbed
SetTimer("waittimer", 900000, false); //Normal Mode 5 minutes
/*We run the timer(5 minutes) for the function that is going to make the
bank available for robbing again
*/
//SetTimer("waittimer", 65000, false); //Test Mode 65 seconds
SetTimer("robtimer", 300000, false);
SetPlayerWantedLevel(playerid, 3);
PlayerInfo[playerid][pWantedLevel] = 3;
/* We also run another timer(1 minute) for the function that is
actually going to give us the money and a user friendly message.
*/
/*
Add a function that would notify the police.
*/

SendClientMessageToAll(0x00FF00FF,"[BREAKING NEWS] Bank is being robbed, do not come near the bank!");
SendClientMessageToAll(0x0080FFFF, "Alerting all POLICE to come at bank As Soon as possible!!!");
SendClientMessageToAll(0x0080FFFF, "Lahat ng police PUMUNTA sa BANK Ngayon din!!!");

SendClientMessage(playerid, 0xFF0000FF, "You are robbing the bank, the police has been notified!");
SendClientMessage(playerid, 0x008000FF, "You gotta stay 5 minutes before you get the moneys!!!");


} else return SendClientMessage(playerid, COLOR_WHITE, "You are not in BANK SAFE!!");
} else {
SendClientMessage(playerid, COLOR_WHITE, "You can't rob the bank right now! Already rob or waiting for cool down");
}
return 1;
}

public robtimer(playerid)
{
new string[128];//We are defining a new string for the formatted message that we are displaying later on.
new cash = random(2000000);
GivePlayerMoney(playerid, cash);
/*
With the fuction above 'new cash = random(200000);
GivePlayerMoney(playerid, cash);' we give the player
a random amount of money from $0 - $200,000
*/
//Here below we use the string we defined above to format the message itself and display it to the player.
format(string, sizeof(string), "You have successfully robbed $%d from the bank!", cash);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "[BREAKING NEWS] The suspect %s has successfully rob the money bank", GetPlayerNameEx(playerid));
SendClientMessageToAll(0x008000FF, string);
SetPlayerWantedLevel(playerid, 6);
PlayerInfo[playerid][pWantedLevel] = 6;
}

Trynda
22/05/2014, 12:39 PM
CMD:robbank(playerid, params[])
{
if(robpossible == 1) //If the bank can be robbed we continue below
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, 2319.2310,-2.0349,26.7496))
{//Next thing we do is, we check if we are at the bank interior ^^
robpossible = 0; //Then we set the bank so it cannot be robbed
SetTimer("waittimer", 900000, false); //Normal Mode 5 minutes
/*We run the timer(5 minutes) for the function that is going to make the
bank available for robbing again
*/
//SetTimer("waittimer", 65000, false); //Test Mode 65 seconds
SetTimer("robtimer", 300000, false);
SetPlayerWantedLevel(playerid, 3);
PlayerInfo[playerid][pWantedLevel] = 3;
/* We also run another timer(1 minute) for the function that is
actually going to give us the money and a user friendly message.
*/
/*
Add a function that would notify the police.
*/

SendClientMessageToAll(0x00FF00FF,"[BREAKING NEWS] Bank is being robbed, do not come near the bank!");
SendClientMessageToAll(0x0080FFFF, "Alerting all POLICE to come at bank As Soon as possible!!!");
SendClientMessageToAll(0x0080FFFF, "Lahat ng police PUMUNTA sa BANK Ngayon din!!!");

SendClientMessage(playerid, 0xFF0000FF, "You are robbing the bank, the police has been notified!");
SendClientMessage(playerid, 0x008000FF, "You gotta stay 5 minutes before you get the moneys!!!");


} else return SendClientMessage(playerid, COLOR_WHITE, "You are not in BANK SAFE!!");
} else {
SendClientMessage(playerid, COLOR_WHITE, "You can't rob the bank right now! Already rob or waiting for cool down");
}
return 1;
}

public robtimer(playerid)
{
new string[128];//We are defining a new string for the formatted message that we are displaying later on.
new cash = random(2000000);
GivePlayerMoney(playerid, cash);
/*
With the fuction above 'new cash = random(200000);
GivePlayerMoney(playerid, cash);' we give the player
a random amount of money from $0 - $200,000
*/
//Here below we use the string we defined above to format the message itself and display it to the player.
format(string, sizeof(string), "You have successfully robbed $%d from the bank!", cash);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "[BREAKING NEWS] The suspect %s has successfully rob the money bank", GetPlayerNameEx(playerid));
SendClientMessageToAll(0x008000FF, string);
SetPlayerWantedLevel(playerid, 6);
PlayerInfo[playerid][pWantedLevel] = 6;
}

It doesnt work at all.

Thanks in advance!

Diverse
22/05/2014, 12:39 PM
It should work though... Or you're doing something wrong.
EDIT : It sets your wanted level and your wanted level player variable.

Trynda
22/05/2014, 12:41 PM
I dunno why, lel

and yes i think it should be work :3

rappy93
22/05/2014, 12:42 PM
Do you have a PlayerInfo enum with pWantedLevel in it ?

Trynda
22/05/2014, 12:49 PM
Do you have a PlayerInfo enum with pWantedLevel in it ?

Yes, i have...

rappy93
22/05/2014, 12:53 PM
Then post it here so we can see it.

Trynda
22/05/2014, 01:16 PM
Then post it here so we can see it.

lol you dont trust me :3

enum pInfo
{
pKey[129],
pLevel,
pAdmin,
pAdminName[32],
pBanAppealer,
pGangMod,
pDonator,
pBanned,
pPermaBanned,
pDisabled,
pIP[16],
pReg,
pTut,
pSex,
pAge,
pSkin,
Float:pPos_x,
Float:pPos_y,
Float:pPos_z,
Float:pPos_r,
pConnectTime,
pRespect,
pNumber,
pWarns,
pGang,
pFaction,
pLeader,
pRank,
pJob,
pJob2,
gPupgrade,
Float:pSarmor,
pCash,
pBank,
pInsurance,
pCrimes,
pArrested,
pWantedLevel,
Float:pHealth,
Float:pArmor,
pPot,
pCrack,
pPackages,
pCrates,
pRadio,
pRadioFreq,
pPhoneBook,
pDice,
pCDPlayer,
pMats,
pRope,
pCigar,
pSprunk,
pSpraycan,
pHouse,
pHouse2,
pRenting,
pInt,
pVW,
pJailed,
pJailTime,
pGuns[12],
pAGuns[12],
pPayCheck,
pPayReady,
pHospital,
pDetSkill,
pLawSkill,
pSexSkill,
pDrugsSkill,
pSmugSkill,
pArmsSkill,
pMechSkill,
pFishSkill,
pBoxSkill,
pTruckSkill,
pCarSkill,
//pCraftSkill,
pLawyerTime,
pLawyerFreeTime,
pDrugsTime,
pMechTime,
pSexTime,
pCarTime,
pFishes,
pBiggestFish,
pLockCar, // non-saved
pWeedObject,
Float: pWeedPos[3],
pWeedVW,
pWeedInt,
pWeedGrowth,
pWSeeds,
pWins,
pLoses,
pFightStyle,
pScrewdriver,
pSmslog,
pWristwatch,
pTire,
pFirstaid,
pRccam,
pReceiver,
pGPS,
pSweep,
pSweepLeft,
pBugged,
pVehicleKeys,
pVehicleKeysFrom,
pDuty,
pCarLic,
pFlyLic,
pBoatLic,
pFishLic,
pGunLic,
pDivision,
pLiveBanned,
pTicketTime,
pHeadValue,
pContractBy[32],
pContractDetail[64],
pC4,
pC4Get,
pC4Used,
pBombs,
pCHits,
pFHits,
pPrisonedBy[MAX_PLAYER_NAME],
pPrisonReason[128],
pAcceptReport,
pTrashReport,
pAccent,
pNMute,
pNMuteTotal,
pADMute,
pADMuteTotal,
pRMuted,
pRMutedTotal,
pRMutedTime,
pSpeedo,
pGCMuted,
pGCMutedTime,
pCallsAccepted,
pHelper,
pPatientsDelivered,
pTriageTime,
pMarried,
pMarriedTo[MAX_PLAYER_NAME],
pKillLog0[128],
pKillLog1[128],
pKillLog2[128],
pKillLog3[128],
pKillLog4[128],
pKillLog5[128],
pKillLog6[128],
pKillLog7[128],
pKillLog8[128],
pKillLog9[128],
pFlag[128],
pReferredBy[MAX_PLAYER_NAME],
pTokens,
pRefTokensOffline,
};

rappy93
22/05/2014, 01:20 PM
Show me what erros pop up when you use these :

SetPlayerWantedLevel(playerid, 3);
PlayerInfo[playerid][pWantedLevel] = 3;

Trynda
22/05/2014, 01:24 PM
Show me what erros pop up when you use these :

SetPlayerWantedLevel(playerid, 3);
PlayerInfo[playerid][pWantedLevel] = 3;


Nothing errors,

rappy93
22/05/2014, 01:26 PM
Then let's try to debug it.

Do it like this :


SetPlayerWantedLevel(playerid, 3);
PlayerInfo[playerid][pWantedLevel] = 3;
printf("Your wanted level is : %d", PlayerInfo[playerid][pWantedLevel]);


Then go to your log and see what is says there. Then paste it here.

Trynda
22/05/2014, 01:35 PM
Then let's try to debug it.

Do it like this :


SetPlayerWantedLevel(playerid, 3);
PlayerInfo[playerid][pWantedLevel] = 3;
printf("Your wanted level is : %d", PlayerInfo[playerid][pWantedLevel]);


Then go to your log and see what is says there. Then paste it here.

I think I found out the problem. Its on /robbank

It doesnt show on console when i type the cmd /robbank it wont also show the "printf thing" maybe i use the crashdetect and let me try it :)


[22/05/2014 21:49:22] Number of vehicle models: 114
[22/05/2014 21:50:18] Incoming connection: 127.0.0.1:51090
[22/05/2014 21:50:18] [join] UnknownProH4x has joined the server (0:127.0.0.1)
[22/05/2014 21:51:00] [cmd] [UnknownProH4x]: /gotoco 2319.2310 -2.0349 26.7496 0

See? it only shows what i type the /gotoco CMD

BTW, while im using the crashdetect heres my /robbank code
CMD:robbank(playerid, params[])
{
if(robpossible == 1) //If the bank can be robbed we continue below
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, 2319.2310,-2.0349,26.7496))
{//Next thing we do is, we check if we are at the bank interior ^^
robpossible = 0; //Then we set the bank so it cannot be robbed
SetTimer("waittimer", 900000, false); //Normal Mode 5 minutes
/*We run the timer(5 minutes) for the function that is going to make the
bank available for robbing again
*/
//SetTimer("waittimer", 65000, false); //Test Mode 65 seconds
SetTimer("robtimer", 300000, false);
/* We also run another timer(1 minute) for the function that is
actually going to give us the money and a user friendly message.
*/
/*
Add a function that would notify the police.
*/

SendClientMessageToAll(0x00FF00FF,"[BREAKING NEWS] Bank is being robbed, do not come near the bank!");
SendClientMessageToAll(0x0080FFFF, "Alerting all POLICE to come at bank As Soon as possible!!!");
SendClientMessageToAll(0x0080FFFF, "Lahat ng police PUMUNTA sa BANK Ngayon din!!!");

SendClientMessage(playerid, 0xFF0000FF, "You are robbing the bank, the police has been notified!");
SendClientMessage(playerid, 0x008000FF, "You gotta stay 5 minutes before you get the moneys!!!");

SetPlayerWantedLevel(playerid, 3);
PlayerInfo[playerid][pWantedLevel] = 3;
printf("Your wanted level is : %d", PlayerInfo[playerid][pWantedLevel]);


} else return SendClientMessage(playerid, COLOR_WHITE, "You are not in BANK SAFE!!");
} else {
SendClientMessage(playerid, COLOR_WHITE, "You can't rob the bank right now! Already rob or waiting for cool down");
}
return 1;
}

EDIT: dafuq i use the crashdetect, Theres no debug info created?Then that means theres no problem about the /robbank,

How do i fix this thing please :(

Trynda
22/05/2014, 01:56 PM
u still there????????????????????????????????????????????? ??