Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setPedStat for client side peds #106

Closed
wants to merge 3 commits into from
Closed

setPedStat for client side peds #106

wants to merge 3 commits into from

Conversation

ArranTuna
Copy link
Collaborator

No description provided.

@qaisjp qaisjp added the enhancement New feature or request label Dec 28, 2016
Copy link
Contributor

@jushar jushar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good all in all.

In addition to the in-code comments, you could avoid the double m_pScriptDebugging->LogCustom(...) by something like this:

// ...
    if (!argStream.HasErrors())
    {
        pPed->SetStat(usStat, fValue);
        // ...
    }
}

// at the end:
if (argStream.HasErrors())
    m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage());

if ( !argStream.HasErrors () )
{
// Valid ped?
if ( pPed )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is not necessary as the error case is already handled by CScriptArgReader::HasErrors

m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage ( ) );
}
else
m_pScriptDebugging->LogBadPointer ( luaVM, "ped", 1 );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed then.

Implemented Jusonex's feedback, fixed not checking if stat was < 0 and
changed message about max stat from 231 (highest on MTA wiki) to 343
which is what NUM_PLAYER_STATS is.
@ArranTuna
Copy link
Collaborator Author

Thanks for the review, I've made a new commit. About that if ( pPed ) I assumed that it was needed as many functions in that file have those checks, like getPedStat does. If these checks are useless then can I remove them all in a new patch?

@ArranTuna
Copy link
Collaborator Author

I guess something like this needs adding:
MinClientReqCheck ( argStream, MIN_CLIENT_REQ_REMOVEPEDFROMVEHICLE_CLIENTSIDE, "function is being called client side" );

@4O4 4O4 mentioned this pull request Dec 30, 2016
@ArranTuna
Copy link
Collaborator Author

I seem to have messed up by using the master branch for a pull request so going to close this and make a new one that uses a branch.

@ArranTuna ArranTuna closed this Dec 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants