Advertisement
Luk4s

[PAWN] SetPlayerJobSkinByRank

Sep 28th, 2014
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.07 KB | None | 0 0
  1. new Job[MAX_PLAYERS] = 0, JobRank[MAX_PLAYERS], JobSkin[MAX_PLAYERS];
  2.  
  3. #define MAX_JOBS 4
  4. #define JOBS_RANKS 3
  5.  
  6. new JobsSkinsByRank[MAX_JOBS][JOBS_RANKS] =
  7. {
  8.     {280, 281, 282}, // POLICE
  9.     {274, 275, 276}, // MEDIC
  10.     {171, 240, 255}, // TAXI
  11.     {8,    42, 50}   // MECHANIC
  12. };
  13.  
  14. stock SetPlayerJobSkinByRank(playerid)
  15. {
  16.     // Funkcija skirta nustatyti darbo aprangą pagal darbo rangą.
  17.     if(!Job[playerid]) return 0;
  18.  
  19.         new jobid = Job[playerid]-1, rank = JobRank[playerid];
  20.     if(rank > JOBS_RANKS) return 0;
  21.  
  22.     new JobSkin[playerid] = JobsSkinsByRank[jobid][rank];
  23.     SetPlayerSkin(playerid, JobSkin[playerid]);
  24.     return 1;
  25. }
  26.  
  27. CMD:myrank(playerid, params[])
  28. {
  29.         new rangas;
  30.     if(sscanf(params, "d", rangas)) return 1;
  31.     if(!Job[playerid]) return SendClientMessage(playerid, -1, "Jūs neturite darbo!");
  32.  
  33.     new jobid = Job[playerid]-1;
  34.     if(rangas < JOBS_RANKS)
  35.     {
  36.         JobRank[playerid] = rangas;
  37.         SetPlayerJobSkinByRank(playerid);
  38.  
  39.         printf("skin id by rank: %d", JobSkin[playerid]);
  40.     }
  41.     else SendClientMessage(playerid, -1, "Nėra tokio rango!");
  42.     return 1;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement