if(sInfo[playerid][sSpieler_fraktion] != 4 || sInfo[playerid][sSpieler_arbeit] != 4)return SendClientMessage(playerid,ROT,"Du Bist nicht Berechtigt den Befehl zu Nutzen!");
&& ist dafür da, 2 Sachen zu verbinden, z.B. 2 Sätze (Ich kam heim und aß Gemüse.)
ist dafür da, 2 Sachen zu trennen, also abzufragen, ob ich eins von dem beiden bin / gemacht habe.
Beiträge von Deadmau5
-
-
Bringt nichts, weil die Standardvariable eh 0 ist
Jetzt komm ich bis Print4
//EDIT: Oben mal den Befehl ausgebessert...
//EDIT: Push -
ocmd:respawn(playerid,params[])
{
if(GetPVarInt(playerid,"Fraktion") == 3)
{
for(new i=0; i<sizeof(fbicar); i++)
{
if(!IsVehicleOccupied(i)) SetVehicleToRespawn(fbicar[i]);
}
}
return 1;
}stock IsVehicleOccupied(vehicleid) // Returns 1 if there is anyone in the vehicle
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInAnyVehicle(i))
{
if(GetPlayerVehicleID(i)==vehicleid)
{
return 1;
}
else
{
return 0;
}
}
}
}
} -
Versuchs mal mit r antstatt u...
Ich denk in sscanf 2.0 is r auch enthalten, bringt halt, dass nur Spieler und keine Bots mit dem Befehl verknüpfbar sind
-
if(strcmp(cmdtext,"/cheater",true)==0)
{
if(Admin[playerid] >= 1)
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) SendClientMessage(playerid,0xFF0000FF,"FEHLER: /cheater [playerid/PartOfName]");
new pid;
pid = ReturnUser(tmp);
if(!IsPlayerConnected(pid)) SendClientMessage(playerid,0xFF0000FF,"Dieser Spieler ist nicht online!");
else if(Level[playerid] > 1)) SendClientMessage(playerid,0xFF0000FF,"Dieser Spieler ist nicht Level 1!");
else
{
//Banzeugs
}
}
else SendClientMessage(playerid,0xFF0000FF,"Du bist kein Admin!");
return 1;
} -
-
-
Ich finde das von Sniper ist besser,
wie das hier!
Das ist Snipers
Aber das neuere von Sniper ist halt das DT_DynamicCar, da kann man die Autohäuser InGame erstellen.Aber manche nutzen halt immernoch den Klassiker
-
Um das klarzustellen, ja ich habe die Erlaubnis von [DT]Sniper, meine veränderte Version vom DT_Cars zu veröffentlichen und nein, ich habe den Hauptteil nicht gescriptet!
Neues im 3.1 ist, dass ein Fahrzeugsperrsystem enthalten ist, was von mir eigenhändig gescriptet wurde.
Ein OAmtler kann dieses dann sperren, via Befehl.
[tabmenu]
[tab=/sperrcar]
Parameter: [Kennzeichen] [Sperrpreis] [Grund]Erfordert: Nicht gesperrtes Fahrzeug
Der Grund ist etwas verbuggt, dafür entschuldige ich mich.
Ich versuche ihn in 3.2 zu fixxen.
[tab=/entsperrcar]
Parameter: [Kennzeichen]Erfordert: Gesperrtes Fahrzeug
Eventuell folgt in 3.2 noch ein Grund, z.B. wenns ein Fehler war, oder so.
[tab=/newschild]
Parameter: KeineErfordert: Fahrzeug
Man muss an einem Punkt sein (Nahe Startower), in seinem Fahrzeug, und dann diesen Befehl eingeben, um ein (neues) Kennzeichen zu bekommen.
Falls dein Car gesperrt ist, hilft es trotzdem nichts, ein neues Kennzeichen zu holen -> Dein Fahrzeug ist und bleibt gesperrt
[tab=/freikaufen]
Parameter: KeineErfordert: Gesperrtes Fahrzeug
Nahe der Standard Ordnungsamt Base vom LoH 0.4 ist ein Pickup, bei dem du dein Fahrzeug freikaufen kannst, sofern es gesperrt ist.
[/tabmenu]Downloadlink: DT_Car.pwn
Pastebin: DT_Car.txtGrüße, Mau5 (und [DT]Sniper ^^)
-
Bitte löschen, ich mache einen neuen Thread!
-
Als Filterscript nützt es nichts
-
2. Post, danke an BlackAce
Zitat
4. Baut ihr das unter
public OnGameModeInit()
ein
CreatePickup(1239,1,930.9573,-1207.6936,17.1938,0); // /freikaufen- Punkt
CreatePickup(1239,1,1660.3594,-1282.4482,14.7665,0);// /newschild - Punkt
Create3DTextLabel("Hier kannst du ein Staatliches Kennzeichen beantragen,\nindem du den Befehl \"/newschild\" benutzt.\nWenn du kein Kennzeichen hast,\nkann es sein, dass dein Fahrzeug\nvom Ordnungsamt abgeschleppt wird.", 0xFF0000FF, 1660.3594,-1282.4482,16, 50, 0);
Create3DTextLabel("Hier kannst du dein Fahrzeug mit dem Befehl \n\"/freikaufen\"\nfrei kaufen,\nfalls es gesperrt ist.", 0xFF0000FF, 930.9573,-1207.6936,18, 50, 0);5. Das unter
public OnPlayerStateChange
for(new xv=0;xv<MaxVeh;xv++)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new xdd=GetPlayerVehicleID(playerid);
if(xdd==PlayerCar[playerid][xv][CarId])
{
if(PlayerCar[playerid][xv][CarGesperrt] == 1)
{
new modell = GetVehicleModel(xdd);
format(string,256,"Dein Fahrzeug (%s) ist für %d$ gesperrt.",CarName[modell-400],PlayerCar[playerid][xv][CarSperrpreis]);
SendClientMessage(playerid,0xFF0000FF,string);
SendClientMessage(playerid,0xFF0000FF,"Du kannst es am Ordnungsamt für diesen Preis freikaufen.");
RemovePlayerFromVehicle(playerid);
return 1;
}
}
}
}6. Folgende Sachen ändern:
public OnPlayerBuyCar(playerid,Model,Preis,Autohaus)//CARSYS
{
if(IsPlayerConnected(playerid) && !Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]])
{
CallRemoteFunction("M_GivePlayerMoney","id",playerid,-Preis);
if(Autohaus == 0)
{
AddToBizzTill(14,Preis);
}
else if(Autohaus == 1)
{
AddToBizzTill(12,Preis);
}
else if(Autohaus == 2)
{
AddToBizzTill(21,Preis);
}
else if(Autohaus == 3)
{
AddToBizzTill(15,Preis);
}
else if(Autohaus == 4)
{
AddToBizzTill(13,Preis);
}
SetParkPlatz(playerid,Autohaus);
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, sizeof name);
format(str, sizeof str, "/Autos/%s%d.dtcar", name,Dtc_PlayerKey[playerid]);
new File: hFile = fopen(str, io_write);
if (hFile)
{
new var[32];
format(var, 32, "CarId=0\n");fwrite(hFile, var);
format(var, 32, "CarModel=%d\n",Model);fwrite(hFile, var);
format(var, 32, "CarPos_x=%.3f\n",PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarPos_x]);fwrite(hFile, var);
format(var, 32, "CarPos_y=%.3f\n",PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarPos_y]);fwrite(hFile, var);
format(var, 32, "CarPos_z=%.3f\n",PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarPos_z]);fwrite(hFile, var);
format(var, 32, "CarRotate=%.3f\n",PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarRotate]);fwrite(hFile, var);
format(var, 32, "CarNitro=0\n");fwrite(hFile, var);
format(var, 32, "CarHyd=0\n");fwrite(hFile, var);
format(var, 32, "CarWheel=0\n");fwrite(hFile, var);
format(var, 32, "CarAusp=0\n");fwrite(hFile, var);
format(var, 32, "CarSideL=0\n");fwrite(hFile, var);
format(var, 32, "CarSideR=0\n");fwrite(hFile, var);
format(var, 32, "CarFB=0\n");fwrite(hFile, var);
format(var, 32, "CarRB=0\n");fwrite(hFile, var);
format(var, 32, "CarSpoiler=0\n");fwrite(hFile, var);
format(var, 32, "CarRoof=0\n");fwrite(hFile, var);
format(var, 32, "CarHood=0\n");fwrite(hFile, var);
format(var, 32, "CarVents=0\n");fwrite(hFile, var);
format(var, 32, "CarLamps=0\n");fwrite(hFile, var);
format(var, 32, "CarPJ=-1\n");fwrite(hFile, var);
format(var, 32, "CarC1=-1\n");fwrite(hFile, var);
format(var, 32, "CarC2=-1\n");fwrite(hFile, var);
format(var, 32, "Preis=%d\n",Preis);fwrite(hFile, var);
format(var, 32, "CarPlate=0\n");fwrite(hFile, var);
format(var, 32, "CarGesperrt=0\n");fwrite(hFile, var);
format(var, 32, "CarSperrpreis=0\n");fwrite(hFile, var);
fclose(hFile);
}
OnPlayerCarLogin(playerid);
}
}public OnPlayerCarLogin(playerid)
{
for(new x = 0; x < MaxVeh; x++)
{
if(!Dtc_PlayerHaveCar[playerid][x])
{
new string2[128];
new playername2[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername2, sizeof(playername2));
format(string2, sizeof(string2), "/Autos/%s%d.dtcar", playername2,x);
new File: UserFile = fopen(string2, io_read);
if (UserFile)
{
Dtc_PlayerHaveCar[playerid][x] = 1;
new key[ 256 ] , val[ 256 ];
new Data[ 256 ];
while ( fread( UserFile , Data , sizeof( Data ) ) )
{
key = ini_GetKey( Data );
if( strcmp( key , "CarId" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarId] = strval( val ); }
if( strcmp( key , "CarModel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarModel] = strval( val ); }
if( strcmp( key , "CarPos_x" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPos_x] = floatstr( val ); }
if( strcmp( key , "CarPos_y" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPos_y] = floatstr( val ); }
if( strcmp( key , "CarPos_z" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPos_z] = floatstr( val ); }
if( strcmp( key , "CarRotate" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarRotate] = floatstr( val ); }
if( strcmp( key , "CarNitro" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarNitro] = strval( val ); }
if( strcmp( key , "CarHyd" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarHyd] = strval( val ); }
if( strcmp( key , "CarWheel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarWheel] = strval( val ); }
if( strcmp( key , "CarAusp" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarAusp] = strval( val ); }
if( strcmp( key , "CarSideL" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarSideL] = strval( val ); }
if( strcmp( key , "CarSideR" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarSideR] = strval( val ); }
if( strcmp( key , "CarFB" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarFB] = strval( val ); }
if( strcmp( key , "CarRB" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarRB] = strval( val ); }
if( strcmp( key , "CarSpoiler" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarSpoiler] = strval( val ); }
if( strcmp( key , "CarRoof" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarRoof] = strval( val ); }
if( strcmp( key , "CarHood" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarHood] = strval( val ); }
if( strcmp( key , "CarVents" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarVents] = strval( val ); }
if( strcmp( key , "CarLamps" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarLamps] = strval( val ); }
if( strcmp( key , "CarPJ" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPJ] = strval( val ); }
if( strcmp( key , "CarC1" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarC1] = strval( val ); }
if( strcmp( key , "CarC2" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarC2] = strval( val ); }
if( strcmp( key , "Preis" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPreis] = strval( val ); }
if( strcmp( key , "CarNumber" , true ) == 0 ) { val = ini_GetValue( Data ); strmid(PlayerCar[playerid][x][CarNumber], val, 0, strlen(val)-1, 255); }
if( strcmp( key , "CarPlate" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPlate] = strval( val ); }
if( strcmp( key , "CarGesperrt" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarGesperrt] = strval( val ); }
if( strcmp( key , "CarSperrpreis" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarSperrpreis] = strval( val ); }
}
fclose(UserFile);
PlayerCarSpawn(playerid,x);
}
}
}
}public PlayerCarSpawn(playerid,Slot)
{
if(IsPlayerConnected(playerid))
{
if(Dtc_PlayerHaveCar[playerid][Slot])
{
PlayerCar[playerid][Slot][CarId] = CreateVehicle(PlayerCar[playerid][Slot][CarModel],PlayerCar[playerid][Slot][CarPos_x],PlayerCar[playerid][Slot][CarPos_y],PlayerCar[playerid][Slot][CarPos_z],PlayerCar[playerid][Slot][CarRotate],PlayerCar[playerid][Slot][CarC1],PlayerCar[playerid][Slot][CarC2], 60000);/*vehicle spawn*/
ChangeVehicleColor(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarC1],PlayerCar[playerid][Slot][CarC2]);
if(PlayerCar[playerid][Slot][CarPJ] >= 0) {ChangeVehiclePaintjob(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarPJ]);}
if(PlayerCar[playerid][Slot][CarNitro] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarNitro]);}
if(PlayerCar[playerid][Slot][CarHyd] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarHyd]);}
if(PlayerCar[playerid][Slot][CarWheel] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarWheel]);}
if(PlayerCar[playerid][Slot][CarAusp] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarAusp]);}
if(PlayerCar[playerid][Slot][CarSideL] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarSideL]);}
if(PlayerCar[playerid][Slot][CarSideR] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarSideR]);}
if(PlayerCar[playerid][Slot][CarFB] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarFB]);}
if(PlayerCar[playerid][Slot][CarRB] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarRB]);}
if(PlayerCar[playerid][Slot][CarSpoiler] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarSpoiler]);}
if(PlayerCar[playerid][Slot][CarRoof] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarRoof]);}
if(PlayerCar[playerid][Slot][CarHood] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarHood]);}
if(PlayerCar[playerid][Slot][CarVents] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarVents]);}
if(PlayerCar[playerid][Slot][CarLamps] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarLamps]);}
if(PlayerCar[playerid][Slot][CarPlate] != 0) {SetVehicleNumberPlate(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarNumber]);}
if(Dtc_LockOnSpawn)
{
Dtc_Carlock[PlayerCar[playerid][Slot][CarId]] = 1;
Dtc_LockCar(PlayerCar[playerid][Slot][CarId]);
}
}
}
}
public OnVehicleMod(playerid,vehicleid,componentid)
{
for(new x = 0; x < MaxVeh; x++)
{
if (vehicleid == PlayerCar[playerid][x][CarId] && Dtc_PlayerHaveCar[playerid][x])
{
if((componentid >= 1008) && (componentid <= 1010)) {PlayerCar[playerid][x][CarNitro] = componentid;}
if((componentid >= 1142) && (componentid <= 1145)) {PlayerCar[playerid][x][CarVents] = componentid;}
if((componentid == 1013) || (componentid == 1024)) {PlayerCar[playerid][x][CarLamps] = componentid;}
if((componentid >= 1004) && (componentid <= 1005)||(componentid >= 1011) && (componentid <= 1012)) {PlayerCar[playerid][x][CarHood] = componentid;}
if(componentid == 1087) {PlayerCar[playerid][x][CarHyd] = componentid;}
if(componentid == 1086) {PlayerCar[playerid][x][CarHyd] = componentid;}
if(IsAWheel(componentid)) {PlayerCar[playerid][x][CarWheel] = componentid;}
if(IsAExhaust(componentid)) {PlayerCar[playerid][x][CarAusp] = componentid;}
if(IsASideL(componentid)) {PlayerCar[playerid][x][CarSideL] = componentid; PlayerCar[playerid][x][CarSideR] = SideR;}
if(IsASideR(componentid)) {PlayerCar[playerid][x][CarSideR] = componentid; PlayerCar[playerid][x][CarSideL] = SideL;}
if(IsAFB(componentid)) {PlayerCar[playerid][x][CarFB] = componentid;}
if(IsARB(componentid)) {PlayerCar[playerid][x][CarRB] = componentid;}
if(IsASpoiler(componentid)) {PlayerCar[playerid][x][CarSpoiler] = componentid;}
if(IsARoof(componentid)) {PlayerCar[playerid][x][CarRoof] = componentid;}
}
}
return 1;
}
public OnPlayerCarUpdate(playerid)
{
if(IsPlayerConnected(playerid))
{
for(new x = 0; x < MaxVeh; x++)
{
if(Dtc_PlayerHaveCar[playerid][x])
{
DestroyVehicle(PlayerCar[playerid][x][CarId]);
//PlayerCar[playerid][x][CarId] = CreateVehicle(PlayerCar[playierd][x][CarModel],PlayerCar[playerid][x][CarPos_x],PlayerCar[playerid][x][CarPos_y],PlayerCar[playerid][x][CarPos_z],PlayerCar[playerid][x][CarRotate]
Dtc_Carlock[PlayerCar[playerid][x][CarId]] = 0;
Dtc_LockCar(PlayerCar[playerid][x][CarId]);
new string3[128];
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
format(string3, sizeof(string3), "/Autos/%s%d.dtcar", playername3,x);
new File: hFile = fopen(string3, io_write);
if (hFile)
{
new var[32];
format(var, 32, "CarId=%d\n",PlayerCar[playerid][x][CarId]);fwrite(hFile, var);
format(var, 32, "CarModel=%d\n",PlayerCar[playerid][x][CarModel]);fwrite(hFile, var);
format(var, 32, "CarPos_x=%.3f\n",PlayerCar[playerid][x][CarPos_x]);fwrite(hFile, var);
format(var, 32, "CarPos_y=%.3f\n",PlayerCar[playerid][x][CarPos_y]);fwrite(hFile, var);
format(var, 32, "CarPos_z=%.3f\n",PlayerCar[playerid][x][CarPos_z]);fwrite(hFile, var);
format(var, 32, "CarRotate=%.3f\n",PlayerCar[playerid][x][CarRotate]);fwrite(hFile, var);
format(var, 32, "CarNitro=%d\n",PlayerCar[playerid][x][CarNitro]);fwrite(hFile, var);
format(var, 32, "CarHyd=%d\n",PlayerCar[playerid][x][CarHyd]);fwrite(hFile, var);
format(var, 32, "CarWheel=%d\n",PlayerCar[playerid][x][CarWheel]);fwrite(hFile, var);
format(var, 32, "CarAusp=%d\n",PlayerCar[playerid][x][CarAusp]);fwrite(hFile, var);
format(var, 32, "CarSideL=%d\n",PlayerCar[playerid][x][CarSideL]);fwrite(hFile, var);
format(var, 32, "CarSideR=%d\n",PlayerCar[playerid][x][CarSideR]);fwrite(hFile, var);
format(var, 32, "CarFB=%d\n",PlayerCar[playerid][x][CarFB]);fwrite(hFile, var);
format(var, 32, "CarRB=%d\n",PlayerCar[playerid][x][CarRB]);fwrite(hFile, var);
format(var, 32, "CarSpoiler=%d\n",PlayerCar[playerid][x][CarSpoiler]);fwrite(hFile, var);
format(var, 32, "CarRoof=%d\n",PlayerCar[playerid][x][CarRoof]);fwrite(hFile, var);
format(var, 32, "CarHood=%d\n",PlayerCar[playerid][x][CarHood]);fwrite(hFile, var);
format(var, 32, "CarVents=%d\n",PlayerCar[playerid][x][CarVents]);fwrite(hFile, var);
format(var, 32, "CarLamps=%d\n",PlayerCar[playerid][x][CarLamps]);fwrite(hFile, var);
format(var, 32, "CarPJ=%d\n",PlayerCar[playerid][x][CarPJ]);fwrite(hFile, var);
format(var, 32, "CarC1=%d\n",PlayerCar[playerid][x][CarC1]);fwrite(hFile, var);
format(var, 32, "CarC2=%d\n",PlayerCar[playerid][x][CarC2]);fwrite(hFile, var);
format(var, 32, "Preis=%d\n",PlayerCar[playerid][x][CarPreis]);fwrite(hFile, var);
format(var, 32, "CarPlate=%d\n",PlayerCar[playerid][x][CarPlate]);fwrite(hFile, var);
format(var, 32, "CarNumber=%s\n",PlayerCar[playerid][x][CarNumber]);fwrite(hFile, var);
format(var, 32, "CarGesperrt=%d\n",PlayerCar[playerid][x][CarGesperrt]);fwrite(hFile, var);
format(var, 32, "CarSperrpreis=%d\n",PlayerCar[playerid][x][CarSperrpreis]);fwrite(hFile, var);
fclose(hFile);
}
PlayerCarSpawn(playerid,x);
}
}
}
}Grüße, die Mau5
-
und wie leuft das ganze ab kann ich das mal mit dir testen habe es drin
Na logo, schick IP ;DBTT: Wie gesagt, du musst es anpassen
-
Das sind alles nur Schnipsel, ihr müsst sie in euer Script richtig einbauen
Zitat
Also, heute mach ich mal ein Tutorial, welches auf dem DT_Cars System und dem LoH 0.4 Script basiert (zumindest habe ich es damit getestet )Nebenbei wird hier auch noch ein Kennzeichen Tutorial erklärt!
Also, fangen wir an:
1. Ändert ihr euer
enum dtc_PlayerCar { };
zu diesem um://by Dusl12 aka Deadmau5
//Wer das Copyright entfernt macht sich strafbar!
enum dtc_PlayerCar
{
CarId,
CarOwner[MAX_PLAYER_NAME],
CarModel,
Float:CarPos_x,
Float:CarPos_y,
Float:CarPos_z,
Float:CarRotate,
CarNitro,
CarHyd,
CarWheel,
CarAusp,
CarSideL,
CarSideR,
CarFB,
CarRB,
CarSpoiler,
CarRoof,
CarHood,
CarVents,
CarLamps,
CarPJ,
CarC1,
CarC2,
CarPreis,
CarPlate,
CarNumber[32],
CarGesperrt,
CarSperrpreis
};2. Baut ihr das hier unten ein (einfach unten im Script.):
forward GetOwner(veh); //Credits an [DT]Sniper
public GetOwner(veh)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
for(new x = 0; x < MaxVeh; x++)
{
if(PlayerCar[i][x][CarId] == veh){return i;}
}
}
return 555;
}
stock KZExistiert(string[])
{
for(new v=0;v<MAX_VEHICLES;v++)
{
if(IsADtCar(v))
{
for(new x=0;x<MaxVeh;x++)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
if(strcmp(string,PlayerCar[i][x][CarNumber],true)==0)
{
return 1;
}
}
}
}
}
}
return 0;
}
stock GetCarFromKZ(string[])
{
for(new v=0;v<MAX_VEHICLES;v++)
{
if(IsADtCar(v))
{
for(new x=0;x<MaxVeh;x++)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
if(strcmp(PlayerCar[i][x][CarNumber],string,true)==0)
{
return PlayerCar[i][x][CarId];
}
}
}
}
}
}
return 0;
}
stock IsDtCarGesperrt(vehicle)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsADtCar(vehicle))
{
for(new x=0;x<MaxVeh;x++)
{
if(IsPlayerConnected(i))
{
if(vehicle == PlayerCar[i][x][CarId])
{
if(PlayerCar[i][x][CarGesperrt] == 1)
{
return 1;
}
}
}
}
}
}
return 0;
}3. Baut ihr diese Befehle im Script ein:
if (strcmp("/carlist", cmdtext, true)==0)
{
if(Dtc_PlayerHaveCar[playerid][0] && !Dtc_PlayerHaveCar[playerid][1])
{
SendClientMessage(playerid,0xFFFFFFFF,">> Carliste <<");
format(string,sizeof(string),"Fahrzeug: %s || Kennzeichen: %s",CarName[PlayerCar[playerid][0][CarModel]-400],PlayerCar[playerid][0][CarNumber]);
SendClientMessage(playerid,0x00FFFFFF,string);
SendClientMessage(playerid,0xFFFFFFFF,">> Carliste <<");
}
if(Dtc_PlayerHaveCar[playerid][1] && !Dtc_PlayerHaveCar[playerid][0])
{
SendClientMessage(playerid,0xFFFFFFFF,">> Carliste <<");
format(string,sizeof(string),"Fahrzeug: %s || Kennzeichen: %s",CarName[PlayerCar[playerid][1][CarModel]-400],PlayerCar[playerid][1][CarNumber]);
SendClientMessage(playerid,0x00FFFFFF,string);
SendClientMessage(playerid,0xFFFFFFFF,">> Carliste <<");
}
if(Dtc_PlayerHaveCar[playerid][0] && Dtc_PlayerHaveCar[playerid][1])
{
SendClientMessage(playerid,0xFFFFFFFF,">> Carliste <<");
format(string,sizeof(string),"Fahrzeug: %s || Kennzeichen: %s",CarName[PlayerCar[playerid][0][CarModel]-400],PlayerCar[playerid][0][CarNumber]);
SendClientMessage(playerid,0x00FFFFFF,string);
format(string,sizeof(string),"Fahrzeug: %s || Kennzeichen: %s",CarName[PlayerCar[playerid][1][CarModel]-400],PlayerCar[playerid][1][CarNumber]);
SendClientMessage(playerid,0x00FFFFFF,string);
SendClientMessage(playerid,0xFFFFFFFF,">> Carliste <<");
}
if(!Dtc_PlayerHaveCar[playerid][0] && !Dtc_PlayerHaveCar[playerid][1])
{
SendClientMessage(playerid,0xFF0000FF,"Du hast garkein Fahrzeug!");
}
return 1;
}
if(strcmp(cmd,"/freikaufen",true)==0)
{
if(IsPlayerInRangeOfPoint(playerid,2.5,930.9573,-1207.6936,17.1938))
{
if(PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarGesperrt] == 1)
{
if(GetPlayerMoney(playerid) >= PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarSperrpreis])
{
GivePlayerMoney(playerid,-PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarSperrpreis]);
format(string,256,"Du hast deinen %s für %d$ wieder frei gekauft. Hoffentlich kommt das nicht noch einmal vor.",CarName[PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarModel]-400],PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarSperrpreis]);
SendClientMessage(playerid,0x00FFFFFF,string);
PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarGesperrt] = 0;
FraktionsKasse[23] += PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarSperrpreis];
new xx[MAX_PLAYER_NAME];
GetPlayerName(playerid,xx,sizeof(xx));
format(string,256,"%s hat sein Fahrzeug (%s) für %d$ freigekauft. Das Geld wurde auf die Fraktionskasse überwiesen.",xx,CarName[PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarModel]-400],PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarSperrpreis]);
SendRadioMessage(24, TEAM_BLUE_COLOR, string);
PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarSperrpreis]=0;
SetVehiclePos(PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId],937.4331,-1226.2257,16.5307);
SetVehicleZAngle(PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId],180);
PutPlayerInVehicle(playerid,PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId],0);
return 1;
}
else
{
SendClientMessage(playerid,0xFF0000FF,"Du hast nicht genug Geld.");
return 1;
}
}
else
{
SendClientMessage(playerid,0xFF0000FF,"Dieses Fahrzeug ist nicht gesperrt.");
SendClientMessage(playerid,0xFF0000FF,"Stelle sicher, dass du den richtigen Schlüssel ausgewählt hast.");
return 1;
}
}
else
{
SendClientMessage(playerid,0xFF0000FF,"Du bist nicht am \"/freikaufen\"-Punkt.");
return 1;
}
}
if(strcmp(cmd,"/newschild",true)==0)
{
if(IsPlayerInRangeOfPoint(playerid,2.5,1660.3594,-1282.4482,14.7665))
{
if(IsPlayerInAnyVehicle(playerid))
{
new car = GetPlayerVehicleID(playerid);
if(IsADtCar(car))
{
if(Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]])
{
if(car == PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId])
{
new rndzahl, stringg[32];
rndzahl = random(8999)+1000;
format(stringg,sizeof(stringg),"%d",rndzahl);
if(KZExistiert(stringg))
{
rndzahl = rndzahl-1;
format(stringg,sizeof(stringg),"%d",rndzahl);
}
PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarPlate] = 1;
//format(PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarNumber],sizeof(PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarNumber]),"%d",rndzahl);
PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarNumber] = stringg;
format(string,sizeof(string),"Dein neues Kennzeichen ist: %d",rndzahl);
SendClientMessage(playerid,0x00FFFFFF,string);
new Float:CarX,Float:CarY,Float:CarZ,Float:CarA;
GetVehiclePos(car,CarX,CarY,CarZ);
GetVehicleZAngle(car,CarA);
DestroyVehicle(car);
PlayerCarSpawn(playerid,Dtc_PlayerKey[playerid]);
SetVehiclePos(PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId],CarX,CarY,CarZ);
SetVehicleZAngle(PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId],CarA);
PutPlayerInVehicle(playerid,PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId],0);
return 1;
}
else
{
SendClientMessage(playerid,0xFF0000FF,"Das ist nicht dein Fahrzeug!");
return 1;
}
}
else
{
SendClientMessage(playerid,0xFF0000FF,"Du musst den richtigen Schlüssel ausgewählt haben!");
return 1;
}
}
}
else
{
SendClientMessage(playerid,0xFF0000FF,"Du bist in keinem Fahrzeug!");
return 1;
}
}
else
{
SendClientMessage(playerid,0xFF0000FF,"Du bist nicht am /newschild-Punkt.");
return 1;
}
}
if(strcmp(cmd,"/entsperrcar",true)==0)
{
if(IsPlayerInFrac(playerid,24))
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,0xFF0000FF,"FEHLER: /entsperrcar [Kennzeichen]");
return 1;
}
new kz[32];
format(kz,sizeof(kz),"%s",tmp);
if(KZExistiert(kz))
{
new kzveh = GetCarFromKZ(kz);
if(IsDtCarGesperrt(kzveh))
{
new modell = GetVehicleModel(kzveh);
new gpid = GetOwner(kzveh);
new gpidname[MAX_PLAYER_NAME];
GetPlayerName(gpid,gpidname,sizeof(gpidname));
format(string,sizeof(string),"Du hast das Kennzeichen %s (User: %d || Name: %s || Fahrzeug: %s) entsperrt.",kz,gpid,gpidname,CarName[modell-400]);
SendClientMessage(playerid,0x00FFFFFF,string);
new pnn[MAX_PLAYER_NAME];
GetPlayerName(playerid,pnn,sizeof(pnn));
format(string,sizeof(string),"%s hat dein Fahrzeug %s entsperrt.",pnn,CarName[modell-400]);
SendClientMessage(gpid,0xFF0000FF,string);
for(new x=0;x<MaxVeh;x++)
{
if(strcmp(PlayerCar[gpid][x][CarNumber],kz,true)==0)
{
PlayerCar[gpid][x][CarGesperrt] = 0;
PlayerCar[gpid][x][CarSperrpreis]=0;
}
}
return 1;
}
else
{
SendClientMessage(playerid,0xFF0000FF,"Dieses Fahrzeug ist nicht gesperrt.");
return 1;
}
}
else
{
SendClientMessage(playerid,0xFF0000FF,"Dieses Kennzeichen wurde nicht registriert.");
return 1;
}
}
else
{
SendClientMessage(playerid,0xFF0000FF,"Du bist kein Ordnungsamtmitglied.");
return 1;
}
}
if(strcmp(cmd,"/sperrcar",true)==0)
{
if(IsPlayerInFrac(playerid,24))
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,0xFF0000FF,"FEHLER: /sperrcar [Kennzeichen] [Preis] [Grund]");
return 1;
}
new kz[32];
format(kz,sizeof(kz),"%s",tmp);
if(KZExistiert(kz))
{
tmp=strtok(cmdtext,idx);
if(!strlen(tmp))
{
format(string,128,"FEHLER: /sperrcar %s [Sperrpreis] [Grund]",kz);
SendClientMessage(playerid,0xFF0000FF,string);
return 1;
}
new preis;
preis = strval(tmp);
if(preis >= 1)
{
tmp=strtok(cmdtext,idx);
if(!strlen(tmp))
{
format(string,128,"FEHLER: /sperrcar %s %d [Grund]",kz,preis);
SendClientMessage(playerid,0xFF0000FF,string);
return 1;
}
new grund[256];
format(grund,sizeof(grund),"%s",tmp);
new kzveh = GetCarFromKZ(kz);
if(!IsDtCarGesperrt(kzveh))
{
new modell = GetVehicleModel(kzveh);
new gpid = GetOwner(kzveh);
new gpidname[MAX_PLAYER_NAME];
GetPlayerName(gpid,gpidname,sizeof(gpidname));
format(string,sizeof(string),"Du hast das Kennzeichen %s (User: %d || Name: %s || Fahrzeug: %s) für %d$ mit folgendem Grund gesperrt: %s",kz,gpid,gpidname,CarName[modell-400],preis,grund);
SendClientMessage(playerid,0x00FFFFFF,string);
new pnn[MAX_PLAYER_NAME];
GetPlayerName(playerid,pnn,sizeof(pnn));
format(string,sizeof(string),"%s hat dein Fahrzeug %s mit dem Kennzeichen %s für %d$ mit folgendem Grund gesperrt: %s",pnn,CarName[modell-400],kz,preis,grund);
SendClientMessage(gpid,0xFF0000FF,string);
for(new x=0;x<MaxVeh;x++)
{
if(strcmp(PlayerCar[gpid][x][CarNumber],kz,true)==0)
{
PlayerCar[gpid][x][CarGesperrt] = 1;
PlayerCar[gpid][x][CarSperrpreis]=preis;
}
}
return 1;
}
else
{
SendClientMessage(playerid,0xFF0000FF,"Dieses Fahrzeug ist bereits gesperrt.");
return 1;
}
}
else
{
SendClientMessage(playerid,0xFF0000FF,"Der Sperrpreis darf nicht unter 0 sein.");
return 1;
}
}
else
{
SendClientMessage(playerid,0xFF0000FF,"Dieses Kennzeichen wurde nicht registriert.");
return 1;
}
}
else
{
SendClientMessage(playerid,0xFF0000FF,"Du bist kein Ordnungsamtmitglied.");
return 1;
}
}Das ganze wurde von MIR geschrieben.
Hier der Link: Link - Forum.sa-mp.comGrüße, die Mau5
2. Post folgt...
-
Ist kein Klammerfehler
1. Mach aus dem x2,y2 und z2 ab Zeile 2598 mal jeweils x3,y3 und z3.
2. CreateDynamicObject zu CreateObject
3. MoveDynamicObject zu MoveObject
4. DestroyDynamicObject zu DestroyObject
5. TogglePlayerDynamicCP vermutlich zu TogglePlayerCP -
stock LoadFrakCars()
{
new fc;
new string[16];
while(fc<50)
{
format(string, sizeof(string),"%d",fc);
FrakCarInfo[fc][Model] = mysql_GetInt("vehicles", "Model", "id", string);
FrakCarInfo[fc][x] = mysql_GetFloat("vehicles", "x", "id", string);
FrakCarInfo[fc][y] = mysql_GetFloat("vehicles", "y", "id", string);
FrakCarInfo[fc][z] = mysql_GetFloat("vehicles", "z", "id", string);
FrakCarInfo[fc][a] = mysql_GetFloat("Vehicles", "a", "id", string);
FrakCarInfo[fc][Color1] = mysql_GetInt("vehicles", "Color1", "id", string);
FrakCarInfo[fc][Color2] = mysql_GetInt("vehicles", "Color2", "id", string);
if(FrakCarInfo[fc][Model] >= 400 && FrakCarInfo[fc][Model] <= 611)
{
FrakCarInfo[fc][CarID] = AddStaticVehicleEx(FrakCarInfo[fc][Model], FrakCarInfo[fc][x], FrakCarInfo[fc][y], FrakCarInfo[fc][z], FrakCarInfo[fc][a], FrakCarInfo[fc][Color1], FrakCarInfo[fc][Color2], -1);
}
fc++;
}
return 1;
}So vielleicht? -
Das ist extra mit DT_Cars geschrieben (LoH 0.4)
ZitatAlso, heute mach ich mal ein Tutorial, welches auf dem DT_Cars System und dem LoH 0.4 Script basiert (zumindest habe ich es damit getestet )
-
-
Omg was isn das fürn Obernoob, der hier immer Rumspammt xDD
Keine Hobbys, was?BTT: Hmm...
Zeig mal bitte dein
mysql_GetInt -
mach mal so
stock LoadFrakCars()
{
new fc;
while(fc<50)
{
FrakCarInfo[fc][Model] = mysql_GetInt("vehicles", "Model", "id",valstr(fc)); //392
FrakCarInfo[fc][x] = mysql_GetFloat("vehicles", "x", "id", valstr(fc));
FrakCarInfo[fc][y] = mysql_GetFloat("vehicles", "y", "id", valstr(fc));
FrakCarInfo[fc][z] = mysql_GetFloat("vehicles", "z", "id", valstr(fc));
FrakCarInfo[fc][a] = mysql_GetFloat("Vehicles", "a", "id", valstr(fc));
FrakCarInfo[fc][Color1] = mysql_GetInt("vehicles", "Color1", "id", valstr(fc));
FrakCarInfo[fc][Color2] = mysql_GetInt("vehicles", "Color2", "id"," valstr(fc)");
if(FrakCarInfo[fc][Model] >= 400 && FrakCarInfo[fc][Model] <= 611)
{
FrakCarInfo[fc][CarID] = AddStaticVehicleEx(FrakCarInfo[fc][Model], FrakCarInfo[fc][x], FrakCarInfo[fc][y], FrakCarInfo[fc][z], FrakCarInfo[fc][a], FrakCarInfo[fc][Color1], FrakCarInfo[fc][Color2], -1);
}
fc++;
}
return 1;
}
Denn ich denke, mysql_GetInt, GetFloat, was auch immer, erfordern einen String