#1

Is there any evidence for Cops ranks?

Example: If the PoliceMan arrest someone +1arrest for him and if he got 350arrest update his rank to 2 Like that... how to do that? Just give me a example... because i dont have any idea
Reply
#2

new Arrest[MAX_PLAYERS];
new rank[MAX_PLAYERS];

CMD:arrest(playerid, params[])
{
if(Arrest[playerid] >= 350) ranker[playerid] ++;
}

just check it when he arresting someone
Reply
#3

How to save the ranks? and how to make names for ranks.!!
Reply
#4

It's like the same of the login and register, like you save the passwords, And ip's, You save the rank with them too, Also that depends on the include you use, MySQL or Dini, Can you give me the code of the register command/dialog please?

Also, You'll have to test when player talks, if he got specific rank, just put the rank name next to it, Just give me the code of register command or dialog and i will show you how
Reply
#5

You might look around for some saving tutorial but for making rankname, you could make it dynamic like leaders are able to edit it, just save it in the database, or use the array

enum rankinfo
{
name[64],
factionid
};

new rank[][rankinfo] =
{
{"PO1", 1},
//... something
{"Chief of Police", 1}
};

for call them just do

you might use it like

do SetPVarInt(playerid, "Rank", 1);

then /myrank
format(string, sizeof(string), "your rank is %d", rank[GetPVarInt(playerid, "rank")][name]);
SendClientMessage(playerid, -1, string);

and it would say your rank is 1
Reply
#6

You don't have to save ranks in saving system. Just do like this. When a player's arrests are loaded
PHP код:
//....Getting arrests from database
if(arrests >= 200//200 is the number for that specified Rank.
{
    
PlayerRank Regular//Assign your variable to the rank.
}
if(
arrests >= 300)
{
    
PlayerRank Leader;
}
//And so on. 
But if you want to skip the hassle of assigning scores and ranks and also code repeatation like the above.
You can also do this. And this way will also be easier for future adding.
PHP код:
enum RanksInfo
{
    
ID,
    
ArrestsNeeded,
    
Name[30]
};
new 
RanksArray[TOTAL_RANKS][RanksInfo] = 
{
    { 
1250"Leader" },
    { 
2300"Owner" //See how easily you can add these.
};

//When the arrests are loaded.
for(new iTOTAL_RANKSi++) //Loop.
{
    if(
arrests >= RanksArray[i][ArrestsNeeded]) //If arrests are greater then the specified `arrests needed`.
    
{
         
PlayerRank RanksArray[i][ID]; //Assign the variable.
    
}

Reply
#7

Quote:
Originally Posted by coool
Посмотреть сообщение
You don't have to save ranks in saving system. Just do like this. When a player's arrests are loaded
PHP код:
//....Getting arrests from database
if(arrests >= 200//200 is the number for that specified Rank.
{
    
PlayerRank Regular//Assign your variable to the rank.
}
if(
arrests >= 300)
{
    
PlayerRank Leader;
}
//And so on. 
But if you want to skip the hassle of assigning scores and ranks and also code repeatation like the above.
You can also do this. And this way will also be easier for future adding.
PHP код:
enum RanksInfo
{
    
ID,
    
ArrestsNeeded,
    
Name[30]
};
new 
RanksArray[TOTAL_RANKS][RanksInfo] = 
{
    { 
1250"Leader" },
    { 
2300"Owner" //See how easily you can add these.
};
//When the arrests are loaded.
for(new iTOTAL_RANKSi++) //Loop.
{
    if(
arrests >= RanksArray[i][ArrestsNeeded]) //If arrests are greater then the specified `arrests needed`.
    
{
         
PlayerRank RanksArray[i][ID]; //Assign the variable.
    
}

You have to. Or everytime player relogs his arrests gonna reset, Think!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)