Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.44 KB | None | 0 0
  1. dcmd_challenge(playerid, params[])
  2. {
  3. new target;
  4. if(sscanf(params, "u", target)) return SendClientMessage(playerid,COLOR_ERROR, "[Bot:] /challenge <PlayerID/PlayerName>");
  5. else
  6. {
  7. if (ChallengeOpponentID[target] != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_ERROR, "Player is already in a race");
  8. ChallengeOpponentID[target] = playerid;
  9. ChallengeOpponentID[playerid] = target;
  10. OnPlayerRequestingChallnge(playerid, target);
  11. }
  12. return 1;
  13. }
  14.  
  15. dcmd_accept(playerid, params[])
  16. {
  17. if (ChallengeOpponentID[target] == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_ERROR, "Nobody challenged you");
  18. // this is where you start the race
  19. return 1;
  20. }
  21.  
  22. public OnPlayerRequestingChallnge(playerid,target)
  23. {
  24. if(PlayerInfo[playerid][pRacing] == 0)
  25. {
  26. PlayerInfo[playerid][pRacing] = 1;
  27. ShowMenuForPlayer(RaceDestination,playerid);
  28. SendClientMessage(playerid,COLOR_SERVER,"[Bot:] Choose your race destination!");
  29. return 1;
  30. }
  31. if(PlayerInfo[playerid][pRacing] == 1)
  32. {
  33. new CityText[64],string[128],pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME];
  34. GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
  35. GetPlayerName(target, tName, MAX_PLAYER_NAME);
  36.  
  37. if(RaceDest[playerid] == 1) { CityText = "Los Santos"; }
  38. else if(RaceDest[playerid] == 2) { CityText = "San Fierro"; }
  39. else if(RaceDest[playerid] == 3) { CityText = "Las Venturas"; }
  40.  
  41. format(string, sizeof(string), "[Bot:] Player %s has challenged you to a street race to %s",pName,CityText);
  42. SendClientMessage(target,COLOR_HEADING,string);
  43. SendClientMessage(playerid,COLOR_SERVER,"[Bot:] You must now wait till they accept.");
  44.  
  45. TogglePlayerControllable(playerid,0);
  46. TogglePlayerControllable(target,0);
  47.  
  48. // RaceOffer[target] = 1;
  49. return 1;
  50. }
  51. return 1;
  52. }
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61. public OnPlayerSelectedMenuRow(playerid, row)
  62. {
  63. new Menu:current;
  64. current = GetPlayerMenu(playerid);
  65. if(current == RaceDestination)
  66. {
  67. switch(row)
  68. {
  69. case 0:{
  70. // LS
  71. RaceDest[playerid] = 1;
  72. OnPlayerRequestingChallnge(playerid,ChallengeOpponentID[playerid]);
  73. }
  74. case 1:{
  75. //SF
  76. RaceDest[playerid] = 2;
  77. OnPlayerRequestingChallnge(playerid,ChallengeOpponentID[playerid]);
  78. }
  79. case 2:{
  80. //LV
  81. RaceDest[playerid] = 3;
  82. OnPlayerRequestingChallnge(playerid,ChallengeOpponentID[playerid]);
  83.  
  84. }
  85. }
  86. }
  87.  
  88. return 1;
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement