18.03.2012, 22:13
Here the Right code
Код:
/******************************************************************************* * SERVER NAME: Las Venturas FUN DM - WHO CARES? * SERVER VERSION: v2 * SERVER DEVELOPER: Tony_Stark * * INFORMATION: TEST SV TO GAIN SCRIPTING EXP! * *******************************************************************************/ #include <a_samp> #include <a_npc> #define COLOR_GREEN 0x33AA33AA #define COLOR_RED 0xAA3333AA #define COLOR_YELLOW 0xFFFF00AA #define COLOR_WHITE 0xFFFFFFAA #define COLOR_BLUE 0x0000BBAA #define COLOR_LIGHTBLUE 0x33CCFFAA #define COLOR_ORANGE 0xFF9900AA #define COLOR_RED 0xAA3333AA #define COLOR_LIME 0x10F441AA #define RECORDING "mynpc" //This is the filename of your recording without the extension. #define RECORDING_TYPE 1 //1 for in vehicle and 2 for on foot main(){} public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING); #if RECORDING_TYPE == 1 public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING); public OnNPCExitVehicle() StopRecordingPlayback(); #else public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING); #endif new Tony_Stark; new Nathan_Stark; new ammu1; new ammu2; new MyFirstNPCVehicle; //Global variable! main() { print("\n----------------------------------"); print(" Las Venturas FUN DM - who cares?"); print("----------------------------------\n"); } public OnGameModeInit() { // NPC's ConnectNPC("Dave","mynpc"); print("my gamemode"); ConnectNPC("MyFirstNPC","mynpc"); MyFirstNPCVehicle = CreateVehicle(400, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); // Gamemode SetGameModeText("FUN"); // Pickups ammu1 = CreatePickup(1318,1,2158.0803,942.8740,10.8203); ammu2 = CreatePickup(1318,1,285.7993,-84.5452,1001.5156); // Anims UsePlayerPedAnims(); //disable auto enter, (to buildings, as in singplayer) DisableInteriorEnterExits(); // Player Spawns AddPlayerClass(188, 2025.1615,1346.3495,10.8203, 269.1425, 0, 0, 0, 0, 0, 0); AddPlayerClass(217, 2068.3379,1305.8334,11.6515,181.8136, 0, 0, 0, 0, 0, 0); // Personal Vehicles Tony_Stark = CreateVehicle(520,2049.2783,1300.2842,10.6719,1,0,1,60); Nathan_Stark = CreateVehicle(520,2048.1777,1304.9973,11.6263,1,0,1,60); // Vehicles AddStaticVehicle(522,2068.3379,1305.8334,11.6515,181.8136,6,25); AddStaticVehicle(522,2031.9823,1361.4525,10.3772,268.9690,6,25); AddStaticVehicle(522,2031.8800,1363.1105,10.3942,268.6747,6,25); //objects return 1; } public OnGameModeExit() { return 1; } public OnPlayerRequestClass(playerid, classid) { SetPlayerPos(playerid,2009.9299,1355.8009,10.8184); SetPlayerCameraPos(playerid,2002.9272,1355.7941,10.0156); SetPlayerCameraLookAt(playerid,2002.9272,1355.7941,10.0156); return 1; } public OnPlayerConnect(playerid) { SendClientMessage(playerid, COLOR_YELLOW,"Welcome to Project LV FUN! ;)"); new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); format(string, sizeof(string), "%s has joined the server.", name); SendClientMessageToAll(COLOR_GREEN, string); SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL,2000); SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL_SILENCED,2000); SetPlayerSkillLevel(playerid,WEAPONSKILL_DESERT_EAGLE,2000); SetPlayerSkillLevel(playerid,WEAPONSKILL_SHOTGUN,2000); SetPlayerSkillLevel(playerid,WEAPONSKILL_SAWNOFF_SHOTGUN,2000); SetPlayerSkillLevel(playerid,WEAPONSKILL_SPAS12_SHOTGUN,2000); SetPlayerSkillLevel(playerid,WEAPONSKILL_MICRO_UZI,2000); SetPlayerSkillLevel(playerid,WEAPONSKILL_MP5,2000); SetPlayerSkillLevel(playerid,WEAPONSKILL_AK47,2000); SetPlayerSkillLevel(playerid,WEAPONSKILL_M4,2000); SetPlayerSkillLevel(playerid,WEAPONSKILL_SNIPERRIFLE,2000); return 1; } public OnPlayerDisconnect(playerid, reason) { return 1; } public OnPlayerSpawn(playerid) { if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC. { new npcname[MAX_PLAYER_NAME]; GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name. if(!strcmp(npcname, "MyFirstNPC", true)) //Checking if the NPC's name is MyFirstNPC { PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0); //Putting the NPC into the vehicle we created for it. } return 1; } //Other stuff for normal players goes here! return 1; } public OnPlayerDeath(playerid, killerid, reason) { return 1; } public OnVehicleSpawn(vehicleid) { return 1; } public OnVehicleDeath(vehicleid, killerid) { return 1; } public OnPlayerText(playerid, text[]) { return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/jetpack", cmdtext, true, 10) == 0) { SetPlayerSpecialAction(playerid, 2); return 1; } if (strcmp(cmdtext, "/ammu", true) == 0) { if(IsPlayerInRangeOfPoint(playerid,10,2158.0803,942.8740,10.8203)) { SetPlayerPos(playerid,285.7993,-84.5452,1001.5156); SetPlayerInterior(playerid, 10); SetCameraBehindPlayer(playerid); return 1; } } if (strcmp(cmdtext, "/ammu", true) == 0) { if(IsPlayerInRangeOfPoint(playerid,10,285.7993,-84.5452,1001.5156)) { SetPlayerPos(playerid,2158.0803,942.8740,10.8203); SetPlayerInterior(playerid, 0); SetCameraBehindPlayer(playerid); return 1; } } if(strcmp(cmdtext, "/spawn", true) == 0) { SetPlayerPos(playerid, 2025.1615,1346.3495,10.8203); return 1; } if (strcmp(cmdtext, "/lock", true)==0) { if(IsPlayerInAnyVehicle(playerid)) { new State=GetPlayerState(playerid); if(State!=PLAYER_STATE_DRIVER) { SendClientMessage(playerid,0xFFFF00AA,"You must be the driver to lock your vechicle!"); return 1; } new i; for(i=0;i<MAX_PLAYERS;i++) { if(i != playerid) { SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 1); } } SendClientMessage(playerid, 0xFFFF00AA, "Vehicle locked!"); new Float:pX, Float:pY, Float:pZ; GetPlayerPos(playerid,pX,pY,pZ); PlayerPlaySound(playerid,1056,pX,pY,pZ); } else { SendClientMessage(playerid, 0xFFFF00AA, "You're not in a vehicle!"); } return 1; } if (strcmp(cmdtext, "/unlock", true)==0) { if(IsPlayerInAnyVehicle(playerid)) { new State=GetPlayerState(playerid); if(State!=PLAYER_STATE_DRIVER) { SendClientMessage(playerid,0xFFFF00AA,"You must be the driver of the vechicle to unlock!"); return 1; } new i; for(i=0;i<MAX_PLAYERS;i++) { SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 0); } SendClientMessage(playerid, 0xFFFF00AA, "Vehicle unlocked!"); new Float:pX, Float:pY, Float:pZ; GetPlayerPos(playerid,pX,pY,pZ); PlayerPlaySound(playerid,1057,pX,pY,pZ); } else { SendClientMessage(playerid, 0xFFFF00AA, "You're not in a vehicle!"); } return 1; } return 0; } public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { if(vehicleid == Tony_Stark) { new pName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,sizeof(pName)); if(strcmp(pName,"Tony_Stark") == 0) { SendClientMessage(playerid,-1,"Welcome to your vehicle Tony_Stark!"); } else { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid,-1,"Get the fuzz out of Tony_Stark's vehicle!!!"); return 1; } } if(vehicleid == Nathan_Stark) { new pName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,sizeof(pName)); if(strcmp(pName,"Nathan_Stark") == 0) { SendClientMessage(playerid,-1,"Welcome to your vehicle Nathan_Stark!"); } else { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid,-1,"Get the fuzz out of Nathan_Stark's vehicle!!!"); } return 1; } return 0; } public OnPlayerExitVehicle(playerid, vehicleid) { return 1; } public OnPlayerStateChange(playerid, newstate, oldstate) { return 1; } public OnPlayerEnterCheckpoint(playerid) { return 1; } public OnPlayerLeaveCheckpoint(playerid) { return 1; } public OnPlayerEnterRaceCheckpoint(playerid) { return 1; } public OnPlayerLeaveRaceCheckpoint(playerid) { return 1; } public OnRconCommand(cmd[]) { return 1; } public OnPlayerRequestSpawn(playerid) { return 1; } public OnObjectMoved(objectid) { return 1; } public OnPlayerObjectMoved(playerid, objectid) { return 1; } public OnPlayerPickUpPickup(playerid, pickupid) { if(pickupid == ammu1) { GameTextForPlayer(playerid,"~r~ /ammu ~y~ to enter gun store!",3000,1); return 1; } if(pickupid == ammu2) { GameTextForPlayer(playerid,"~r~ /ammu ~y~ to exit gun store!",3000,1); } return 1; }