How to make spawn colors FR
From SA-MP Wiki
(Difference between revisions)
Revision as of 14:16, 4 March 2013 Smithy (Talk | contribs) ← Previous diff |
Current revision Connor Mead (Talk | contribs) |
||
Line 1: | Line 1: | ||
- | __TOC__ | + | {{delete|it's empty and it don't gonna be used}} |
- | + | ||
- | == Saving which class the player selects == | + | |
- | To set the color to a certain one (e.g. a team-color), we need to save which class has been selected by the player. We can achieve this by a new global variable, which is just for the purpose of saving the class that is selected on the spawn-selection-screen. | + | |
- | <pawn>new pClass[MAX_PLAYERS]; // Stores the player's class</pawn> | + | |
- | + | ||
- | == Ajout de deux classes == | + | |
- | Pour ajouter une couleur particulière pour une certaine classe | + | |
- | <pawn> | + | |
- | public OnGameModeInit() | + | |
- | { | + | |
- | AddPlayerClass(106,2512.8611,-1673.2799,13.5104,87.7485,0,0,0,0,0,0); // Classe 0 | + | |
- | AddPlayerClass(107,2508.1372,-1656.6781,13.5938,129.4222,0,0,0,0,0,0); // Classe 1 | + | |
- | return 1; | + | |
- | }</pawn> | + | |
- | + | ||
- | == Detection de la class choisie== | + | |
- | When we want to set the color upon the color later, we need to find out what class has been selected. | + | |
- | <pawn> | + | |
- | public OnPlayerRequestClass(playerid, classid) | + | |
- | { | + | |
- | pClass[playerid] = classid; | + | |
- | return 1; | + | |
- | } | + | |
- | </pawn> | + | |
- | + | ||
- | == Changement de la couleur du joueur a l'apparition == | + | |
- | Il y à deux méthodes différentes pour verifier si pClass est égal à 0 où 1. | + | |
- | <h3>1ère Méthode</h3> | + | |
- | <pawn> | + | |
- | public OnPlayerSpawn(playerid) | + | |
- | { | + | |
- | + | ||
- | switch(pClass[playerid]) | + | |
- | { | + | |
- | case 0: | + | |
- | { | + | |
- | SetPlayerColor(playerid, 0xFF6600AA); // Orange | + | |
- | } | + | |
- | case 1: | + | |
- | { | + | |
- | SetPlayerColor(playerid, 0xFF0000AA); // Rouge | + | |
- | } | + | |
- | } | + | |
- | return 1; | + | |
- | }</pawn> | + | |
- | <h3>2ème Méthode</h3> | + | |
- | <pawn> | + | |
- | public OnPlayerSpawn(playerid) | + | |
- | { | + | |
- | if(pClass[playerid]==0) | + | |
- | { | + | |
- | SetPlayerColor(playerid, 0xFF6600AA); //Orange | + | |
- | } | + | |
- | if(pClass[playerid]==1) | + | |
- | { | + | |
- | SetPlayerColor(playerid, 0xFF0000AA); //Orange | + | |
- | } | + | |
- | return 1; | + | |
- | }</pawn> | + | |
- | + | ||
- | Voilà, maintenant quand le joueur apparaîtra, il sera orange si il a choisi la classe 0, et rouge si il a choisi la classe 1. | + |
Current revision
This page has been suggested for deletion. it's empty and it don't gonna be used [ Discuss ][ What links here? ] |