warning in a command, command doesn't work
#1

Hello, I got a warning in one of my commands that makes it unable once released from prison they don't get back their guns warning:


Код:
warning 202: number of arguments does not match definition

line:

PHP код:
            for(new 012x++) GivePlayerValidWeapon(giveplayeridPlayerInfo[giveplayerid][pJailedWeapons][x]); 
Reply
#2

number of arguments means that you messed a param there, i assume its the ammo one, you used GivePlayerValidWeapon which is as i assume an anti weapon cheat, you did giveplayerid and weaponid but you forgot to add the ammo.
Reply
#3

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
number of arguments means that you messed a param there, i assume its the ammo one, you used GivePlayerValidWeapon which is as i assume an anti weapon cheat, you did giveplayerid and weaponid but you forgot to add the ammo.
here is the full code:

PHP код:
hook OnDialogResponse(playeriddialogidresponselistiteminputtext[]) {
    if(
arrAntiCheat[playerid][ac_iFlags][AC_DIALOGSPOOFING] > 0) return 1;
    new 
string[128];
    if(
dialogid == DIALOG_REVERSE) {
        new 
rPlayerID GetPVarInt(playerid"ReverseFromID");
        new 
releasedID GetPVarInt(rPlayerID"ReverseID");
        if(
response) {
            if(
PlayerInfo[releasedID][pJailedInfo][1] > 0GivePlayerCash(releasedIDPlayerInfo[releasedID][pJailedInfo][1]);
            if(
PlayerInfo[releasedID][pJailedInfo][3] == 1PlayerInfo[releasedID][pWarns]--;
            
format(string128"AdmCmd: %s(%d) has been released from prison (/reverse) by %s, reason: Reversed (%s)"GetPlayerNameEx(releasedID), GetPlayerSQLId(releasedID), GetPlayerNameEx(playerid), GetPlayerNameEx(rPlayerID));
            
Log("logs/admin.log"string);
            
format(string128"AdmCmd: %s has been released from prison by %s, reason: Reversed (%s)"GetPlayerNameEx(releasedID), GetPlayerNameEx(playerid), GetPlayerNameEx(rPlayerID));
            
SendClientMessageToAllEx(COLOR_LIGHTREDstring);
            
//PlayerInfo[releasedID][pWantedLevel] = 0;
            
PlayerInfo[releasedID][pBeingSentenced] = 0;
            
SetPlayerToTeamColor(releasedID);
            
SetHealth(releasedID100);
            
//SetPlayerWantedLevel(releasedID, 0);
            
PlayerInfo[releasedID][pJailTime] = 0;
            
SetPlayerPos(releasedID1529.6,-1691.2,13.3);
            
SetPlayerInterior(releasedID,0);
            
PlayerInfo[releasedID][pInt] = 0;
            
SetPlayerVirtualWorld(releasedID0);
            
PlayerInfo[releasedID][pVW] = 0;
            
strcpy(PlayerInfo[releasedID][pPrisonReason], "None"128);
            
SetPlayerToTeamColor(releasedID);
            for(new 
012x++) GivePlayerValidWeapon(releasedIDPlayerInfo[releasedID][pJailedWeapons][x]);
            for(new 
05y++) PlayerInfo[releasedID][pJailedInfo][y] = 0;
            for(new 
012z++) PlayerInfo[releasedID][pJailedWeapons][z] = 0;
            
SendClientMessageEx(releasedIDCOLOR_LIGHTBLUE"Your punishment has been reversed by the administrator who jailed you.");
        }
        else {
            
format(string128"Administrator %s has denied your request to reverse your action."GetPlayerNameEx(playerid));
            
SendClientMessageEx(rPlayerIDCOLOR_REDstring);
        }
        
DeletePVar(playerid"ReverseFromID");
        
DeletePVar(rPlayerID"ReverseReason");
        
DeletePVar(rPlayerID"ReverseID");
    }
    return 
0;

I don't have ammo ingame
Reply
#4

I won't read that it isn't needed you obviously didn't understand what i said but i'll try to make it more simple, you did this:
Код:
GivePlayerValidWeapon(giveplayerid, PlayerInfo[giveplayerid][pJailedWeapons][x]);
okay? that's a hook for GivePlayerWeapon to avoid weapon cheats, but GivePlayerWeapon has 3 params and what you just used is 2 (playerid and weaponid) so you forgot to add another spot for ammo so it should look like this:
Код:
GivePlayerValidWeapon(giveplayerid, PlayerInfo[giveplayerid][pJailedWeapons][x], ammo_param);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)