Advertisement
Johurt

[SCR] NPC.

Oct 22nd, 2012
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.84 KB | None | 0 0
  1. new lektuvukas;
  2.  
  3. public OnGameModeInit()
  4. {
  5.     ConnectNPC("Pilotas", "lektuvas");
  6.     lektuvukas = AddStaticVehicle(519, 0.0, 0.0, 5.0, 0.0, 3, 3);
  7.     return 1;
  8. }
  9.  
  10. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  11. {
  12.     if(dialogid == DIALOGID)
  13.     {
  14.         if(response)
  15.         {
  16.             new botoID = INVALID_PLAYER_ID, npcname[MAX_PLAYER_NAME];
  17.             for(new p; p < GetMaxPlayers(); p++)
  18.             {
  19.                         if(!IsPlayerNPC(p)) continue;
  20.                     GetPlayerName(p, npcname, sizeof(npcname));
  21.                     if(!strcmp(npcname, "Pilotas", true))
  22.                     {
  23.                             botoID = p;
  24.                             break;
  25.                     }
  26.             }
  27.             if(botoID == INVALID_PLAYER_ID) return 1;
  28.             PutPlayerInVehicle(botoID, lektuvukas, 0);
  29.                 TogglePlayerSpectating(playerid, 1);
  30.                 PlayerSpectateVehicle(playerid, lektuvukas);
  31.         }
  32.     }
  33.     return 1;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement