Hey Beadfish,
da ich nen Wunsch bekommen habe ein "Rentcar-System" zu scripten,
habe ich dieses mal gemacht.
Es ist einfach aufgebaut , es ähnelt auch meinen Frak-car-System (siehe siggi :P),
dennoch ist es anders, hier kann jederman ein Car-mieten (wenn er das benötigte kleingeld hat)
Ein Ordner muss erstellt werden:
ZitatSpoiler anzeigen mietcar
Befehle:
ZitatSpoiler anzeigen /mietnew -> Erstellt ein neues Car -> Admin-befehl
/mietcarp -> Parkt ein Mietcar -> Admin-befehl
/rentmcar -> Mietet ein Car -> User-befehl (vorraussetzung: er darf keins Gemietet haben und das Fahrzeug muss unbenutzt sein!)
/unrentmcar -> Entmietet ein Car -> User-befehl (vorraussetzung: er muss ein Car gemietet haben!)VERSION 1.0.1
/rentlock -> Schließt ein Mietcar ab -> User-befehl (vorraussetzung: ein Gemietetes Car muss vorhanden sein!)
Version:
Bilder(Screen's)[:P]
Der Code (wohl das wichtigste :P)
#define FILTERSCRIPT
#include <dini>
#include <sscanf>
#define BLAU 0x0087FFFF
#define ROT 0xE10000FF
/*
Die Credits gehen an Myname1997
Währe nett wenn es drinne bleibt :P
*/
/*
Im Gamemode muss eingetragen werden:
public MCar_IsPlayerAnAdmin(playerid)
{
if(PlayerInfo[playerid][pAdmin] != 0) return PlayerInfo[playerid][pAdmin]; //hier müsst ihr anstatt pAdmin eure Admin-abfrage rein machen
return 1;
}
*/
{
mietcar,
modelid,
Float:mcx,
Float:mcy,
Float:mcz,
Float:mca,
mcc1,
mcc2,
cpreis,
mcmietkey,
mcBenutzt,
Text3D:mclabel,
mcopen
}
new MCInfo[MAX_CARS][mietcarinfo];
"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 LA", "Hustler", "Intruder", "Primo", "Cargobob", "Tampa", "Sunrise", "Merit",
"Utility", "Nevada", "Yosemite", "Windsor", "Monster A", "Monster B", "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 Carriage", "Trailer 4", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car (LSPD)", "Police Car (SFPD)",
"Police Car (LVPD)", "Police Ranger", "Picador", "S.W.A.T", "Alpha", "Phoenix", "Glendale", "Sadler", "Luggage Trailer A",
"Luggage Trailer B", "Stairs", "Boxville", "Tiller", "Utility Trailer" };
{
print("\n--------------------------------------");
print("Mietsystem\n");
print("By Myname1997\n");
print("--------------------------------------\n");
for(new i=0;i<MAX_CARS;i++)
{
LMC(i);
}
return 1;
}
{
for(new i=0;i<MAX_CARS;i++)
{
SMC(i);
}
return 1;
}
{
for(new i=0;i<MAX_CARS;i++)
{
if(vehicleid == MCInfo[mietcar])
{
if(MCInfo[mcopen] == 0)
{
SendClientMessage(playerid,ROT,"[Mietcar-System-ERROR:] Das Fahrzeug ist Abgeschloßen!");
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
SetPlayerPos(playerid,x,y,z+1);
}
}
}
return 1;
}
public OnPlayerCommandText(playerid,cmdtext[])
{
new cmd[256];
new tmp[256];
new idx;
cmd = strtok(cmdtext, idx);
{
if(IsPlayerConnected(playerid))
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,ROT,"[Mietcar-System-ERROR:] Sie sind in keinem Auto!");
new veh;
veh = GetPlayerVehicleID(playerid);
for(new i=0;i<MAX_CARS;i++)
{
if(veh == MCInfo[mietcar])
{
if(IsPlayerAnAdministrator(playerid) < NEEDEDADMLVL && !IsPlayerAdmin(playerid))
{
SendClientMessage(playerid,ROT,"[Mietcar-System-ERROR:] Sie sind nicht berechtigt dieses Fahrzeug zu parken!");
return 1;
}
new Float:x,Float:y,Float:z,Float:a;
GetVehiclePos(veh,x,y,z);
GetVehicleZAngle(veh,a);
MCInfo[mcx] = x;
MCInfo[mcy] = y;
MCInfo[mcz] = z;
MCInfo[mca] = a;
SMC(i);
SendClientMessage(playerid,BLAU,"[Mietcar-System-MELDUNG:] Fahrzeug geparkt!");
}
}
}
return 1;
}
if(strcmp(cmdtext,"/mietcard",true)==0)
{
if(IsPlayerConnected(playerid))
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,ROT,"[ERROR:] Sie sind in keinem Auto!");
new veh;
veh = GetPlayerVehicleID(playerid);
for(new i=0;i<MAX_CARS;i++)
{
if(veh == MCInfo[mietcar])
{
if(IsPlayerAnAdministrator(playerid) < NEEDEDADMLVL && !IsPlayerAdmin(playerid))
{
SendClientMessage(playerid,ROT,"[Mietcar-System-ERROR:] Sie sind nicht berechtigt dieses Fahrzeug zu parken!");
return 1;
}
Delete3DTextLabel(MCInfo[mclabel]);
DestroyVehicle(MCInfo[mietcar]);
new SDatei[64];
format(SDatei,50,"/mietcar/%d.txt",i);
dini_Remove(SDatei);
SendClientMessage(playerid,BLAU,"[Mietcar-System-MELDUNG:] Fahrzeug gelöscht!");
}
}
}
return 1;
}
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerAnAdministrator(playerid) < NEEDEDADMLVL && !IsPlayerAdmin(playerid)) return 1;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, ROT, "Benutze: /mietnew [model] [farbe1] [farbe2] [mietpreis]");
return 1;
}
new model;
model = strval(tmp);
if(model < 400 || model > 611) return SendClientMessage(playerid,ROT,"[Mietcar-System-ERROR:] Die Modelid darf nicht über 611 bzw. unter 400 liegen!");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, ROT, "Benutze: /mietnew [model] [farbe1] [farbe2] [mietpreis]");
return 1;
}
new farbe1;
farbe1 = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, ROT, "Benutze: /mietnew [model] [farbe1] [farbe2] [mietpreis]");
return 1;
}
new farbe2;
farbe2 = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, ROT, "Benutze: /mietnew [model] [farbe1] [farbe2] [mietpreis]");
return 1;
}
new mietpreis;
mietpreis = strval(tmp);
tmp = strtok(cmdtext,idx);
if(strlen(tmp))
{
SendClientMessage(playerid, ROT, "Benutze: /mietnew [model] [farbe1] [farbe2] [mietpreis]");
return 1;
}
new Float:x,Float:y,Float:z,Float:a;
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,a);
new mietkey2 = random(MAX_CARS)+5000;
CMC(model,x,y,z,a,farbe1,farbe2,mietpreis,mietkey2);
new string[256];
format(string,sizeof(string),"[Mietcar-System-MELDUNG:] Ein(e) %s wurde an den Koordinaten '%f,%f,%f' zu $%d erstellt!",PlayerVehicle[model-400],x,y,z,mietpreis);
SendClientMessage(playerid,BLAU,string);
GameTextForPlayer(playerid,"Mietcar wurde erstellt~n~Vergessen sie es nicht mit~n~~r~/mietcarp~w~ zu Parken!",5000,6);
}
return 1;
}
{
if(IsPlayerConnected(playerid))
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,ROT,"[Mietcar-System-ERROR:] Sie sind in keinem Auto!");
new veh;
veh = GetPlayerVehicleID(playerid);
for(new i=0;i<MAX_CARS;i++)
{
if(veh == MCInfo[mietcar])
{
if(MCInfo[mcBenutzt] == 1) return SendClientMessage(playerid,ROT,"Dieses Fahrzeug wurde bereits gemietet!");
if(Key[playerid] != 0) return SendClientMessage(playerid,ROT,"Sie haben bereits ein car gemietet '/unrentmcar' zum Entmieten!");
if(GetPlayerMoney(playerid) < MCInfo[cpreis]) return SendClientMessage(playerid,ROT,"Sie haben nicht genug Geld dabei!");
Key[playerid] = MCInfo[mcmietkey];
MCInfo[mcBenutzt] = 1;
GivePlayerMoney(playerid,-MCInfo[cpreis]);
GameTextForPlayer(playerid,"Fahrezug gemietet~n~Viel Spass damit!",5000,0);
Delete3DTextLabel(MCInfo[mclabel]);
}
}
}
return 1;
}
if(strcmp(cmdtext,"/rentlock",true)==0)
{
if(IsPlayerConnected(playerid))
{
for(new i=0;i<MAX_CARS;i++)
{
if(Key[playerid] == 0) return SendClientMessage(playerid,ROT,"Sie haben kein car gemietet!");
if(Key[playerid] == MCInfo[mcmietkey])
{
if(MCInfo[mcopen] == 1)
{
MCInfo[mcopen] = 0;
SendClientMessage(playerid,BLAU,"[Mietcar-System-MELDUNG:] Fahrzeug abgeschloßen!");
}
else if(MCInfo[mcopen] == 0)
{
MCInfo[mcopen] = 1;
SendClientMessage(playerid,BLAU,"[Mietcar-System-MELDUNG:] Fahrzeug aufgeschloßen!");
}
}
}
}
return 1;
}
if(strcmp(cmdtext,"/unrentmcar",true)==0)
{
if(IsPlayerConnected(playerid))
{
for(new i=0;i<MAX_CARS;i++)
{
if(Key[playerid] == 0) return SendClientMessage(playerid,ROT,"Sie haben kein car gemietet!");
if(Key[playerid] == MCInfo[mcmietkey])
{
//SetVehicleToRespawn(MCInfo[mietcar]);
DestroyVehicle(MCInfo[mietcar]);
Key[playerid] = 0;
MCInfo[mcBenutzt] = 0;
GameTextForPlayer(playerid,"Fahrezug entmietet~n~!",5000,0);
LMC(i);
}
}
}
return 1;
}
return 1;
}
{
if(newstate==PLAYER_STATE_DRIVER)
{
for(new i=0; i<MAX_CARS; i++)
{
if(GetPlayerVehicleID(playerid)==MCInfo[mietcar])
{
if(!IsPlayerAnAdministrator(playerid) && !IsPlayerAdmin(playerid) && Key[playerid] != MCInfo[mcmietkey] && MCInfo[mcBenutzt] == 1)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,ROT,"Du darfst dieses Fahrzeug nicht fahren.");
}
}
}
}
return 1;
}
{
new SDatei[64];
for(new carid=1;carid<MAX_CARS;carid++)
{
format(SDatei,50,"/mietcar/%d.txt",carid);
if(!fexist(SDatei))
{
dini_Create(SDatei);
dini_IntSet(SDatei,"Model",model);
dini_FloatSet(SDatei,"X",fx);
dini_FloatSet(SDatei,"Y",fy);
dini_FloatSet(SDatei,"Z",fz);
dini_FloatSet(SDatei,"A",fa);
dini_IntSet(SDatei,"Farbe1",farbe1);
dini_IntSet(SDatei,"Farbe2",farbe2);
dini_IntSet(SDatei,"Preis",mietpreis);
dini_IntSet(SDatei,"mietkey",mietkey2);
MCInfo[carid][mietcar] = CreateVehicle(model,fx,fy,fz,fa,farbe1,farbe2,-1);
format(labelstring,sizeof(labelstring),"Fahrzeugname:%s\nPreis:$%d",PlayerVehicle[model-400],mietpreis);
MCInfo[carid][mclabel] = Create3DTextLabel(labelstring, 0xFFFFFFFF, 0.0,0.0,0.0,9.0,0);
Attach3DTextLabelToVehicle(MCInfo[carid][mclabel],MCInfo[carid][mietcar],0,0,0);
MCInfo[carid][modelid] = dini_Int(SDatei,"Model");
MCInfo[carid][mcx] = dini_Float(SDatei,"X");
MCInfo[carid][mcy] = dini_Float(SDatei,"Y");
MCInfo[carid][mcz] = dini_Float(SDatei,"Z");
MCInfo[carid][mca] = dini_Float(SDatei,"A");
MCInfo[carid][cpreis] = dini_Int(SDatei,"Preis");
MCInfo[carid][mcc1] = dini_Int(SDatei,"Farbe1");
MCInfo[carid][mcc2] = dini_Int(SDatei,"Farbe2");
MCInfo[carid][mcmietkey] = dini_Int(SDatei,"mietkey");
MCInfo[carid][mcBenutzt] = 0;
MCInfo[carid][mcopen] = 1;
return 1;
}
}
return 1;
}
{
new SDatei[64];
format(SDatei,50,"/mietcar/%d.txt",carid);
dini_IntSet(SDatei,"Model",MCInfo[carid][modelid]);
dini_FloatSet(SDatei,"X",MCInfo[carid][mcx]);
dini_FloatSet(SDatei,"Y",MCInfo[carid][mcy]);
dini_FloatSet(SDatei,"Z",MCInfo[carid][mcz]);
dini_FloatSet(SDatei,"A",MCInfo[carid][mca]);
dini_IntSet(SDatei,"Farbe1",MCInfo[carid][mcc1]);
dini_IntSet(SDatei,"Farbe2",MCInfo[carid][mcc2]);
dini_IntSet(SDatei,"Preis",MCInfo[carid][cpreis]);
dini_IntSet(SDatei,"mietkey",MCInfo[carid][mcmietkey]);
return 1;
}
{
new SDatei[64];
format(SDatei,50,"/mietcar/%d.txt",carid);
if(!fexist(SDatei)) return 0;
MCInfo[carid][modelid] = dini_Int(SDatei,"Model");
MCInfo[carid][mcx] = dini_Float(SDatei,"X");
MCInfo[carid][mcy] = dini_Float(SDatei,"Y");
MCInfo[carid][mcz] = dini_Float(SDatei,"Z");
MCInfo[carid][mca] = dini_Float(SDatei,"A");
MCInfo[carid][cpreis] = dini_Int(SDatei,"Preis");
MCInfo[carid][mcc1] = dini_Int(SDatei,"Farbe1");
MCInfo[carid][mcc2] = dini_Int(SDatei,"Farbe2");
MCInfo[carid][mcmietkey] = dini_Int(SDatei,"mietkey");
MCInfo[carid][mietcar] = CreateVehicle(MCInfo[carid][modelid],MCInfo[carid][mcx],MCInfo[carid][mcy],MCInfo[carid][mcz],MCInfo[carid][mca],MCInfo[carid][mcc1],MCInfo[carid][mcc2],-1);
MCInfo[carid][mcopen] = 1;
new labelstring[256];
format(labelstring,sizeof(labelstring),"Fahrzeugname:%s\nPreis:$%d",PlayerVehicle[MCInfo[carid][modelid]-400],MCInfo[carid][cpreis]);
MCInfo[carid][mclabel] = Create3DTextLabel(labelstring, 0xFFFFFFFF, 0.0,0.0,0.0,9.0,0);
Attach3DTextLabelToVehicle(MCInfo[carid][mclabel],MCInfo[carid][mietcar],0,0,0);
return 1;
}
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
{
return CallLocalFunction("MCar_IsPlayerAnAdmin","i",playerid);
}
So ich hoffe euch gefällt das Script
So wie meine anderen
--- Download auchnochmal als Dateianhang!!
--- Rentcarsystem jetzt in OCMD eingefügt