Edwin Chauran

martes, 30 de marzo de 2021

Como programar en pawn



Como programar en pawn



szdfasdfasdf
asdfasdfasdfasdfasdfasdfa








/*
#################################################
# RENTA DE VEHICULOS - By KaizerHind | 03/04/22 #
#################################################
*/

#include	<a_samp>
#include    <streamer>
#include    <sscanf2>
#include	<foreach>

#define MIN_vRENT  		0
#define MAX_vRENT       10

#define dVehRenta 20

new VehRentado[MAX_vRENT+1];

new TitleVehicle[][] =
{
	"Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel",
    "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana", "Infernus", "Voodoo",
    "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam", "Esperanto",
    "Taxi", "Washington", "Bobcat", "Whoopee", "BF Injection", "Hunter", "Premier",
    "Enforcer", "Securicar", "Banshee", "Predator", "Bus", "Rhino", "Barracks",
    "Hotknife", "Trailer 1", "Previon", "Coach", "Cabbie", "Stallion", "Rumpo",
    "RC Bandit", "Romero", "Packer", "Monster", "Admiral", "Squalo", "Seasparrow",
   	"Pizzaboy", "Tram", "Trailer 2", "Turismo", "Speeder", "Reefer", "Tropic", "Flatbed",
    "Yankee", "Caddy", "Solair", "Berkley's RC Van", "Skimmer", "PCJ-600", "Faggio",
    "Freeway", "RC Baron", "RC Raider", "Glendale", "Oceanic", "Sanchez", "Sparrow",
    "Patriot", "Quad", "Coastguard", "Dinghy", "Hermes", "Sabre", "Rustler", "ZR-350",
    "Walton", "Regina", "Comet", "BMX", "Burrito", "Camper", "Marquis", "Baggage",
    "Dozer", "Maverick", "News Chopper", "Rancher", "FBI Rancher", "Virgo", "Greenwood",
    "Jetmax", "Hotring", "Sandking", "Blista Compact", "Police Maverick", "Boxvillde",
    "Benson", "Mesa", "RC Goblin", "Hotring Racer A", "Hotring Racer B", "Bloodring Banger",
    "Rancher", "Super GT", "Elegant", "Journey", "Bike", "Mountain Bike", "Beagle",
    "Cropduster", "Stunt", "Tanker", "Roadtrain", "Nebula", "Majestic", "Buccaneer",
    "Shamal", "Hydra", "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck",
   	"Fortune", "Cadrona", "FBI Truck", "Willard", "Forklift", "Tractor", "Combine",
    "Feltzer", "Remington", "Slamvan", "Blade", "Freight", "Streak", "Vortex", "Vincent",
    "Bullet", "Clover", "Sadler", "Firetruck", "Hustler", "Intruder", "Primo", "Cargobob",
    "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite", "Windsor", "Monster",
    "Monster", "Uranus", "Jester", "Sultan", "Stratum", "Elegy", "Raindance", "RC Tiger",
    "Flash", "Tahoma", "Savanna", "Bandito", "Freight Flat", "Streak Carriage", "Kart",
    "Mower", "Dune", "Sweeper", "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley",
    "Stafford", "BF-400", "News Van", "Tug", "Trailer 3", "Emperor", "Wayfarer", "Euros",
    "Hotdog", "Club", "Freight Box", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch",
    "Vehiculo de policia", "Vehiculo de policia", "Vehiculo de policia", "Police Ranger", "Picador", "S.W.A.T Tank", "Alpha",
    "Phoenix", "Glendale", "Sadler", "Luggage Trailer 1", "Luggage Trailer 2", "Stairs Trailer",
   	"Boxville", "Utility Trailer 1", "Utility Trailer 2"
};


main(){print("vRenta.pwn Loaded");}

public OnFilterScriptInit(){
	AddStaticVehicleEx(462, 620.6327, -1573.0813, 15.4425, 90.0000, 1, 1, 60 * 15); //Faggio
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	if(vRentable(vehicleid))
	{
		if(VehRentado[vehicleid])
		{
			foreach(Player,i)
  			{
	    	    if(GetPVarInt(i,"vRentID") == vehicleid)
	    	    {
	    	        DeletePVar(i,"vRentID");
	    	        SendClientMessage(i,-1,"El veh�culo que habias rentado, fue devuelto.");
				}
			}
		}
		VehRentado[vehicleid] = 0;
		return 1;
	}
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if(newstate == PLAYER_STATE_DRIVER)
	{
	    new VehID = GetPlayerVehicleID(playerid);
	    if(vRentable(VehID))
	    {
	    	if(VehRentado[VehID] == 0)
	    	{
	    	    new RS[300];

	    	    format(RS,sizeof(RS),".- Precio: 250$\n.- Modelo: %s",nVehicle(VehID));
	        	ShowPlayerDialog(playerid,dVehRenta,DIALOG_STYLE_MSGBOX,"Vehiculo en Renta",RS,"Rentar","Salir");
			}
			else if(VehRentado[VehID] == 1 && GetPVarInt(playerid,"vRentID") != VehID)
			{
				RemovePlayerFromVehicle(playerid);
				SendClientMessage(playerid, -1, "Al Parecer alguien ya a rentado este vehiculo.");
				return 1;
			}
			else if(VehRentado[VehID] == 1 && GetPVarInt(playerid,"vRentID") == VehID){}
		}
	}
	return 1;
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	switch(dialogid)
	{
    	case dVehRenta:
    	{
			if(!response) return RemovePlayerFromVehicle(playerid);
			if(response)
			{
		    	if(GetPVarInt(playerid,"vRentID"))
		    	{
		        	SendClientMessage(playerid,-1,"�Ya has rentado un veh�culo!");
		        	RemovePlayerFromVehicle(playerid);
				}
				else
				{
					if(GetPlayerMoney(playerid) < 250)
					{
				    	SendClientMessage(playerid,-1, "No posees el dinero suficiente! El valor de renta es de $250.");
						RemovePlayerFromVehicle(playerid);
				    	return 1;
					}
					SendClientMessage(playerid,-1,"Rentaste este veh�culo por $250, en 15 minutos, este desaparecera al trascurrir dicho tiempo.");
					SetPVarInt(playerid, "vRentID", GetPlayerVehicleID(playerid));
					VehRentado[GetPlayerVehicleID(playerid)] = 1;
					GivePlayerMoney(playerid,-250);
				}
			}
			return 1;
		}
	}
	return 1;
}


stock vRentable(vehicleid)
	return (vehicleid >= MIN_vRENT && vehicleid <= MAX_vRENT);


stock nVehicle(vehid)
{
	new
		str[25],
		Model = GetVehicleModel(vehid);

	if(400 <= Model <= 612)
	{
		format(str,sizeof(str),"%s",TitleVehicle[Model-400]);
	}
	else
	{
	    str = "Unknown";
	}
	return str;
}



No hay comentarios:

Publicar un comentario

Blogger Theme designed by Edwin Visuales | 2020