Post: SPRX random number?
05-14-2015, 10:04 PM #1
ItzMatriix
Are you high?
(adsbygoogle = window.adsbygoogle || []).push({}); is there a way with sprx to generate a random number? like how some languages use like a Math.random() to get a number between 0 and 1.
05-15-2015, 11:24 AM #2
SyGnUs
Give a F*** About Your Lifestyle
Originally posted by ItzMatriix View Post
is there a way with sprx to generate a random number? like how some languages use like a Math.random() to get a number between 0 and 1.


There is the rand and srand function that you can try. I never used them in my own SPRX, but if you want to try, they are in the cstdlib.h header, but for srand I think you have to use the ctime.h header from the standard library, both are from there. All info can be found online so you should have looked there first. And most games have there own functions for this. So depending on the game you should be a able to do it that way if you can find the function.
Last edited by SyGnUs ; 05-15-2015 at 11:31 AM.
05-15-2015, 03:14 PM #3
ItzMatriix
Are you high?
Originally posted by SyGnUs View Post
There is the rand and srand function that you can try. I never used them in my own SPRX, but if you want to try, they are in the cstdlib.h header, but for srand I think you have to use the ctime.h header from the standard library, both are from there. All info can be found online so you should have looked there first. And most games have there own functions for this. So depending on the game you should be a able to do it that way if you can find the function.


I'll look around. I tried the rand and srand before and when I tried to build it, it said sprx doesn't support them. I'll see if I can find something in the game.
05-16-2015, 02:54 PM #4
KAYLEB_HD
Vault dweller
Originally posted by ItzMatriix View Post
I'll look around. I tried the rand and srand before and when I tried to build it, it said sprx doesn't support them. I'll see if I can find something in the game.


If your trying to do it from GTA there's a native for that
05-16-2015, 03:02 PM #5
ItzMatriix
Are you high?
Originally posted by HD View Post
If your trying to do it from GTA there's a native for that


im actually trying to do it in the COD games....
05-18-2015, 09:14 AM #6
SyGnUs
Give a F*** About Your Lifestyle
Originally posted by ItzMatriix View Post
im actually trying to do it in the COD games....


There is a couple functions for COD, one is the irand function -

    
opd_s irand_t = { 0x000000, TOC };
int(*irand)(int min, int max) = (int(*)(int, int))&irand_t;
Last edited by SyGnUs ; 05-18-2015 at 03:16 PM.
05-19-2015, 06:27 AM #7
SC58
Former Staff
Originally posted by ItzMatriix View Post
is there a way with sprx to generate a random number? like how some languages use like a Math.random() to get a number between 0 and 1.


Use the PS3 syscall for it

int sys_ss_random_number_generator(id,buffer,size)

or u can google away to generate a random # or whatever in c++ or whatever your coding in
05-19-2015, 10:25 PM #8
ItzMatriix
Are you high?
Originally posted by SC58 View Post
Use the PS3 syscall for it

int sys_ss_random_number_generator(id,buffer,size)

or u can google away to generate a random # or whatever in c++ or whatever your coding in


I tried that and some of it didnt work. it said like SPRx doesnt support this. ill try what you provided. Thanks!

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo