Sign in to follow this  
Medwar

Full Stats weapon at "player spawn"

Recommended Posts

Hello! i triyin create a new script but u have some problems...

the purpose of the script is get maximun stats of all weapons a every players in the spawn.

I look the wiki but dont it doesnt help...

 

Thanks

Share this post


Link to post

https://wiki.multitheftauto.com/wiki/OnPlayerSpawn

https://wiki.multitheftauto.com/wiki/GetPedStat (use 69-79)

From what I understand you want something like this....

function tellStatsOnSpawn ()
	for i = 69,79 do --We use a for loop to go through stats 69-79
		stat = getPedStat ( source, i ) --We get the stat from the source (the player)
		outputChatBox ( stat, source ) --And we output each stat to players chat
	end
end

addEventHandler("onPlayerSpawn", getRootElement(), tellStatsOnSpawn) --When player spawns we trigger function

I have tested this and it works, but not 100% sure what you want to do.  Note that you will have to get the weapon names/IDs yourself.  If you need help with these functions check wiki links then ask if still stuck, hope it helps. :)

_________________

Edit

Sorry, I misread your post...  This will only get the players current weapon stats, I have no clue how to get the max stat and can't find anything on wiki either.  It might be hard-coded into GTA itself.

Edited by kieran

Share this post


Link to post

Apologies for double post, but the above post can no longer be edited.

It appears there is no native function to get peds full stat, but after some quick research.  All weapon stats on the getPedStat function have a maximum of 999 skill, except for pistol, sawn-off and micro-uzi which have a max skill of 500.

So all weapon stat (EXCEPT for stat IDs 69, 73 and 75: Limit for these is 500) have a limit of 999. 

Share this post


Link to post
1 hour ago, kieran said:

Apologies for double post, but the above post can no longer be edited.

It appears there is no native function to get peds full stat, but after some quick research.  All weapon stats on the getPedStat function have a maximum of 999 skill, except for pistol, sawn-off and micro-uzi which have a max skill of 500.

So all weapon stat (EXCEPT for stat IDs 69, 73 and 75: Limit for these is 500) have a limit of 999. 

Thanks for the help but the script dont work.. :S 

Share this post


Link to post

Yes what that script done was got the players CURRENT weapons stats, not their max weapon stats (I read your post wrong)...  What exactly are you trying to do?  Are you trying to get the max stats for all weapons?  You can only set the stats of the following weapons.

  •  

Weapon skills:
Note: see Weapon skill levels for the values that advance weapon skills.

  • 69: WEAPONTYPE_PISTOL_SKILL
  • 70: WEAPONTYPE_PISTOL_SILENCED_SKILL
  • 71: WEAPONTYPE_DESERT_EAGLE_SKILL
  • 72: WEAPONTYPE_SHOTGUN_SKILL
  • 73: WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL
  • 74: WEAPONTYPE_SPAS12_SHOTGUN_SKILL
  • 75: WEAPONTYPE_MICRO_UZI_SKILL
  • 76: WEAPONTYPE_MP5_SKILL
  • 77: WEAPONTYPE_AK47_SKILL
  • 78: WEAPONTYPE_M4_SKILL
  • 79: WEAPONTYPE_SNIPERRIFLE_SKILL

I was wrong, it seems the max level for all weapons is 999, but the script I had was different...  But please tell me more about what you want to do with your script...  Are you trying to get all weapon stats of all players in game?

Share this post


Link to post
6 hours ago, Galactix said:

Just use this https://wiki.multitheftauto.com/wiki/SetPlayerStat for all weapons( you could probably gain time with a table or something containing all the IDs) and add an handler « onPlayerSpawn »

You actually want setPedStat, setPlayerStat is the old one.  And forget the table...  If you just wish to set weapon stats, as I have previously said they are ID's 69-79.

If you want to SET player stats for all weapons when that player spawns use the following script.

function setStatsOnSpawn ()
	for i = 69,79 do --We use a for loop to go through stats 69-79 (all weapon stats you can set)
		stat = setPedStat ( source, i, 1000 ) --We set the stat to full for the player (1000)
	end
end

addEventHandler("onPlayerSpawn", getRootElement(), setStatsOnSpawn) --When player spawns we trigger function

basically in that for loop i = 69, then the stat for ID 69 is set to 1000.  After that i = 70, and it keeps going until i reaches 79.

To get all players weapon stats on spawn use the script I posted earlier

function tellStatsOnSpawn ()
	for i = 69,79 do --We use a for loop to go through stats 69-79
		stat = getPedStat ( source, i ) --We get the stat from the source (the player)
		outputChatBox ( stat, source ) --And we output each stat to players chat 
	end
end

addEventHandler("onPlayerSpawn", getRootElement(), tellStatsOnSpawn) --When player spawns we trigger function

As you can see they are almost identical, but you don't need to get their max stat as we already know:  THE MAX STAT OF ALL SKILLS IS 1000

Edited by kieran

Share this post


Link to post
On 12/7/2018 at 15:58, kieran said:

You actually want setPedStat, setPlayerStat is the old one.  And forget the table...  If you just wish to set weapon stats, as I have previously said they are ID's 69-79.

If you want to SET player stats for all weapons when that player spawns use the following script.


function setStatsOnSpawn ()
	for i = 69,79 do --We use a for loop to go through stats 69-79 (all weapon stats you can set)
		stat = setPedStat ( source, i, 1000 ) --We set the stat to full for the player (1000)
	end
end

addEventHandler("onPlayerSpawn", getRootElement(), setStatsOnSpawn) --When player spawns we trigger function

basically in that for loop i = 69, then the stat for ID 69 is set to 1000.  After that i = 70, and it keeps going until i reaches 79.

To get all players weapon stats on spawn use the script I posted earlier


function tellStatsOnSpawn ()
	for i = 69,79 do --We use a for loop to go through stats 69-79
		stat = getPedStat ( source, i ) --We get the stat from the source (the player)
		outputChatBox ( stat, source ) --And we output each stat to players chat 
	end
end

addEventHandler("onPlayerSpawn", getRootElement(), tellStatsOnSpawn) --When player spawns we trigger function

As you can see they are almost identical, but you don't need to get their max stat as we already know:  THE MAX STAT OF ALL SKILLS IS 1000

The scripts dont run :S ... i want what the player get the maximus skills weapon at spawn....

I dont want the "currents stats"...

I use both of them scripts but dont run

The meta written is:

<meta>
<meta src="script.lua" type"server"/>
</meta>

Share this post


Link to post

@Medwar the first one there DOES set the players stats to max, in San Andreas there is a limit for these skills, if it got current skills and they were 500+ then it worked.  The code is there now you need to go and make something so I can get a better of idea of what you are trying to do, for me that set my full stats.  Go and look at the wiki, see if you can make it work the way you want it to.

  • Thanks 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.