Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Extension of Brian's Multiplayer Struct
- //put this in a header file (.h)
- /*
- Example Usage:
- int tick;
- for(tick = 0; tick <= PLAYER16; tick++){
- YOURFUNCTIONHERE(players[tick].ped);
- YOURFUNCTIONHERE(players[tick].vehicle);
- YOURFUNCTIONHERE(players[tick].id);
- //etc...
- }
- */
- Ped online_char;
- enum ePlayers
- {
- PLAYER1,
- PLAYER2,
- PLAYER3,
- PLAYER4,
- PLAYER5,
- PLAYER6,
- PLAYER7,
- PLAYER8,
- PLAYER9,
- PLAYER10,
- PLAYER11,
- PLAYER12,
- PLAYER13,
- PLAYER14,
- PLAYER15,
- PLAYER16,
- };
- typedef struct Multiplayer{
- char* name;
- Ped ped;
- int id;
- float x,y,z;
- int weapon;
- Vehicle vehicle;
- uint model;
- } Multiplayer;
- Multiplayer players[16];
- void SetMutliplayer(void){
- for(i = 0;i <= 15;i++){
- if(!IS_NETWORK_PLAYER_ACTIVE(i)) continue;
- if(GET_PLAYER_ID() == i) continue;
- GET_PLAYER_CHAR(i,&online_char);
- players[i].ped = online_char;
- players[i].name = GET_PLAYER_NAME(i);
- players[i].id = i;
- if(DOES_CHAR_EXIST(online_char)){
- GET_CURRENT_CHAR_WEAPON(online_char,&players[i].weapon);
- GET_CAR_CHAR_IS_USING(online_char, &players[i].vehicle);
- GET_CHAR_COORDINATES(online_char, &players[i].x,&players[i].y,&players[i].z);
- GET_CHAR_MODEL(online_char,&players[i].model);
- }
- }
- return;
- }
- ///////////////////////////
- //Put this in your main function and have this set to a loop
- do{
- WAIT(0);
- SetMutliplayer();
- } while(true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement