Weird wanted system issues
#1

Hello guys.
Today, I've started a new RPG gamemode, but I have 2 weird issues that I've never had before.

1.When I create a command to increase the wanted level for the player, it should save the Wanted Level into the player's account file.

For the save, under OnPlayerDisconnect i use :

PHP код:
SavedWantedLevel[playerid] =WantedLevel[playerid]; 
The command is :

PHP код:
dcmd_rec(playerid,params[])
{
    new 
ID;
    new 
lvl;
    new 
string[128];
    if(
sscanf(params,"ui",ID,lvl))
    {
        
SendClientMessage(playerid,COLOR_ERROR,"Utilisation: /rec (Pseudo/ID) (Niveau de recherche)");
        return 
1;
    }
    if(
IsSpawned[ID] == 0)
    {
        
format(string,sizeof(string),"Ce joueur doit кtre vivant pour pouvoir utiliser cette commande.",PlayerName(ID),ID);
        
SendClientMessage(playerid,COLOR_ERROR,string);
        return 
1;
    }
    if(!
IsPlayerConnected(ID))
    {
        
format(string,sizeof(string),"Ce joueur n'est pas connectй.",ID);
        
SendClientMessage(playerid,COLOR_ERROR,string);
        return 
1;
    }
    
IncreaseWantedLevel(ID,lvl);
    
WantedLevel[ID] =lvl;
    return 
1;

So normaly, it should save the WantedLevel, but It doesn't.

2. The second issue, is normaly that when the player's wanted level increase to 2, the player's color should be yellow, but it doesn't..

WEIRD..
Hope getting your answers as soon as possible.
Reply
#2

1. This "SavedWantedLevel[playerid] = WantedLevel[playerid];" will do nothing but put the value found in "WantedLevel[playerid]" into "SavedWantedLevel[playerid]", it won't save anything and this may differ on reconnect (the slot/index). You should save the value in "WantedLevel[playerid]" using SQLite or MySQL, and load it when the player logs back in.

2. The function "IncreaseWantedLevel" isn't working properly then.

P.S. Shouldn't your signature say PAWN instead of PAWNO?
Reply
#3

Solved, I've found the error.

Thanks anyway.
Reply
#4

Quote:
Originally Posted by KillerDVX
Посмотреть сообщение
Solved, I've found the error.

Thanks anyway.
Post the solution for future similar cases. And to know what exactly you did. After all, that's what this board is all about.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)