Guten Morgen liebe User
ich habe eine Frage
und zwar wie mache ich ein Motor System.
Wo man mit Der Taste [Alt] Den Motor Starten und Stoppen kannst=
kann mir vielleicht jemand da helfen
mit Freundlichen grüßen Ronny
Guten Morgen liebe User
ich habe eine Frage
und zwar wie mache ich ein Motor System.
Wo man mit Der Taste [Alt] Den Motor Starten und Stoppen kannst=
kann mir vielleicht jemand da helfen
mit Freundlichen grüßen Ronny
So baust du das auf bei OnPlayerkey....
if((newkeys & KEY_NO) && !(oldkeys & KEY_NO))//deine belegung
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
new veh = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
if(Motor[veh] == 0)
{
SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid,Rot,"Motor angeschaltet!");
Motor[veh] = 1;
}
else
{
SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid,Grün,"Motor ausgeschaltet!");
Motor[veh] = 0;
}
}
}
das ist jetzt auf der N taste belegt
die anderen tasten was du haben willst kannst du hier sehen:
http://wiki.sa-mp.com/wiki/GetPlayerKeys
MFG
schnarre
//edit
hier wird so ein Thema auch noch besprochen
Motor Starten mit M aber wie scripten???
Ah Cool dankeschön
hmm habs versucht rein zubauen aber irgentwie bekomme ich immer Pawno Problem hmm kann mir da jemand helfen
Das hier ist meine Zeile wo Füg ich das am Besten hin
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((newkeys==KEY_FIRE)) {
if(IsPlayerInArea(playerid,1120.99, -951.5297, 1349.16, -837.0452)) {
SendClientMessage(playerid,0xFFFF00AA,"Du wurdest 5sek wegen DM gefreezt.");
TogglePlayerControllable(playerid, 0);
SetTimerEx("DmUnfreeze", 5000, 0, "i", playerid);
}
}
return 1;
}
stock IsPlayerInArea(playerid,Float:minX,Float:minY,Float:maxX,Float:maxY)
{
new Float:pX,Float:pY,Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
if(pX >= minX && pX <= maxX && pY >= minY && pY <= maxY) return 1;
else return 0;
}
Wo kann ich das hier reinbauen
if((newkeys & KEY_NO) && !(oldkeys & KEY_NO))//deine belegung
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
new veh = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
if(Motor[veh] == 0)
{
SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid,Rot,"Motor angeschaltet!");
Motor[veh] = 1;
}
else
{
SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid,Grün,"Motor ausgeschaltet!");
Motor[veh] = 0;
}
}
}
EDITE: PWN Txet
danke im vorraus
mfg hunter
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((newkeys==KEY_FIRE))
{
if(IsPlayerInArea(playerid,1120.99, -951.5297, 1349.16, -837.0452))
{
SendClientMessage(playerid,0xFFFF00AA,"Du wurdest 5sek wegen DM gefreezt.");
TogglePlayerControllable(playerid, 0);
SetTimerEx("DmUnfreeze", 5000, 0, "i", playerid);
}
}
if((newkeys & KEY_NO) && !(oldkeys & KEY_NO))//deine belegung
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
new veh = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
if(Motor[veh] == 0)
{
SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid,Rot,"Motor angeschaltet!");
Motor[veh] = 1;
}
else
{
SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid,Grün,"Motor ausgeschaltet!");
Motor[veh] = 0;
}
}
}
return 1;
}
stock IsPlayerInArea(playerid,Float:minX,Float:minY,Float:maxX,Float:maxY)
{
new Float:pX,Float:pY,Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
if(pX >= minX && pX <= maxX && pY >= minY && pY <= maxY) return 1;
else return 0;
}
mfg
C:\Users\Marcel\Desktop\gm.pwn(39835) : warning 219: local variable "lights" shadows a variable at a preceding level
C:\Users\Marcel\Desktop\gm.pwn(39838) : error 017: undefined symbol "Motor"
C:\Users\Marcel\Desktop\gm.pwn(39838) : warning 215: expression has no effect
C:\Users\Marcel\Desktop\gm.pwn(39838) : error 001: expected token: ";", but found "]"
C:\Users\Marcel\Desktop\gm.pwn(39838) : error 029: invalid expression, assumed zero
C:\Users\Marcel\Desktop\gm.pwn(39838) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
die zeilen?
if(Motor[veh] == 0)
Erstellke ganz oben im header eine globale variable die wie folgt aussieht:
new Motor[MAX_VEHICLES] = 0;
mfg
new Motor[MAX_VEHICLES];
oben hinzufügen.
C:\Users\Marcel\Desktop\gm.pwn(39836) : warning 219: local variable "lights" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Warning.
new engine,lights,alarm,doors,bonnet,boot,objective;
änder einfach lights in light,
also im ganzen public onplayerkeystatechange
JO danke also bekomme keine errors habs jetzt ma Getestet aber wenn cih en steige ist der Motor an aber kann hin dann aus und an machen an was Liegt das?
geh mal zu
OnPlayerEnterVehicle
und schreib da dass hier rein:
Motor[GetPlayerVehicleID(playerid)] = 0;
mfg
Ja hab ich gemacht aber irgentwie sist der motor immer ncoh automatich an
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
Motor[GetPlayerVehicleID(playerid)] = 0;
new modelid = GetVehicleModel(vehicleid);
if(modelid == 522)
{
SetPlayerAttachedObject(playerid, 1, 18645, 2, 0.07, 0, 0, 88, 75, 0);
}
if(PlayerInfo[playerid][pCarLic] < 1 && !IsAPlane(vehicleid) && !IsABoat(vehicleid))
{
SendClientMessage(playerid, COLOR_RED, " Du hast keinen Führerschein (15000$) !");
SendClientMessage(playerid, COLOR_RED, " Meide die Polizei, denn wenn du erwischt wirst, siehts nicht gut für dich aus.");
}
new tmp = GetVehicleModel(GetPlayerVehicleID(playerid));
new Float:armor;
GetPlayerArmour(playerid, armor);
if(tmp == 427)
{
SetPlayerArmour(playerid, armor);
return 1;
}
SendClientMessage(playerid,COLOR_ORANGE,"Starte dein Motor Mit der Taste (N)");
SendClientMessage(playerid,COLOR_ORANGE,"Bei Problemen mit ihrem Auto benutzen sie /service adac");
gGas[playerid] = 1;
new string[60];
if(PlayerInfo[playerid][pAdmin] >= 1)
{
format(string, sizeof(string), "AdminInfo: VehicleID: %d || Model: %s[%d]", vehicleid, CarName[modelid-400], modelid);
SendClientMessage(playerid, COLOR_ORANGE, string);
}
if(gTeam[playerid] >= 3)
{
if (IsACopCar(vehicleid) && !ispassenger)
{
if(PlayerInfo[playerid][pMember]==1||PlayerInfo[playerid][pLeader]==1 ||PlayerInfo[playerid][pMember]==2 ||PlayerInfo[playerid][pLeader]==2 ||PlayerInfo[playerid][pMember]==3 ||PlayerInfo[playerid][pLeader]==3) { }
else { WantedPoints[playerid]+=2; SetPlayerCriminal(playerid,255, "Diebstahl"); }
}
}
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
Motor[GetPlayerVehicleID(playerid)] = 0;
new modelid = GetVehicleModel(vehicleid);
if(modelid == 522)
{
SetPlayerAttachedObject(playerid, 1, 18645, 2, 0.07, 0, 0, 88, 75, 0);
}
if(PlayerInfo[playerid][pCarLic] < 1 && !IsAPlane(vehicleid) && !IsABoat(vehicleid))
{
SendClientMessage(playerid, COLOR_RED, " Du hast keinen Führerschein (15000$) !");
SendClientMessage(playerid, COLOR_RED, " Meide die Polizei, denn wenn du erwischt wirst, siehts nicht gut für dich aus.");
}
new tmp = GetVehicleModel(GetPlayerVehicleID(playerid));
new Float:armor;
GetPlayerArmour(playerid, armor);
if(tmp == 427)
{
SetPlayerArmour(playerid, armor);
return 1;
}
SendClientMessage(playerid,COLOR_ORANGE,"Starte dein Motor Mit der Taste (N)");
SendClientMessage(playerid,COLOR_ORANGE,"Bei Problemen mit ihrem Auto benutzen sie /service adac");
gGas[playerid] = 1;
new string[60];
if(PlayerInfo[playerid][pAdmin] >= 1)
{
format(string, sizeof(string), "AdminInfo: VehicleID: %d || Model: %s[%d]", vehicleid, CarName[modelid-400], modelid);
SendClientMessage(playerid, COLOR_ORANGE, string);
}
if(gTeam[playerid] >= 3)
{
if (IsACopCar(vehicleid) && !ispassenger)
{
if(PlayerInfo[playerid][pMember]==1||PlayerInfo[playerid][pLeader]==1 ||PlayerInfo[playerid][pMember]==2 ||PlayerInfo[playerid][pLeader]==2 ||PlayerInfo[playerid][pMember]==3 ||PlayerInfo[playerid][pLeader]==3) { }
else { WantedPoints[playerid]+=2; SetPlayerCriminal(playerid,255, "Diebstahl"); }
}
}
return 1;
}[/quote]
da haste alles richtig gemacht,
mh eventuell was mit der tastenkombination verhauen?
Welche tastenkombination meints denn?? die hier
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((newkeys==KEY_FIRE))
{
if(IsPlayerInArea(playerid,1120.99, -951.5297, 1349.16, -837.0452))
{
SendClientMessage(playerid,0xFFFF00AA,"Du wurdest 5sek wegen DM gefreezt.");
TogglePlayerControllable(playerid, 0);
SetTimerEx("DmUnfreeze", 5000, 0, "i", playerid);
}
}
if((newkeys & KEY_NO) && !(oldkeys & KEY_NO))//deine belegung
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new engine,light,alarm,doors,bonnet,boot,objective;
new veh = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(veh,engine,light,alarm,doors,bonnet,boot,objective);
if(Motor[veh] == 0)
{
SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,light,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid,0xFFFF00AA,"Motor angeschaltet!");
Motor[veh] = 1;
}
else
{
SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,light,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid,0xFFFF00AA,"Motor ausgeschaltet!");
Motor[veh] = 0;
}
}
}
return 1;
}
stock IsPlayerInArea(playerid,Float:minX,Float:minY,Float:maxX,Float:maxY)
{
new Float:pX,Float:pY,Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
if(pX >= minX && pX <= maxX && pY >= minY && pY <= maxY) return 1;
else return 0;
}
Alles anzeigenWelche tastenkombination meints denn?? die hier
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((newkeys==KEY_FIRE))
{
if(IsPlayerInArea(playerid,1120.99, -951.5297, 1349.16, -837.0452))
{
SendClientMessage(playerid,0xFFFF00AA,"Du wurdest 5sek wegen DM gefreezt.");
TogglePlayerControllable(playerid, 0);
SetTimerEx("DmUnfreeze", 5000, 0, "i", playerid);
}
}
if((newkeys & KEY_NO) && !(oldkeys & KEY_NO))//deine belegung
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new engine,light,alarm,doors,bonnet,boot,objective;
new veh = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(veh,engine,light,alarm,doors,bonnet,boot,objective);
if(Motor[veh] == 0)
{
SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,light,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid,0xFFFF00AA,"Motor angeschaltet!");
Motor[veh] = 1;
}
else
{
SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,light,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid,0xFFFF00AA,"Motor ausgeschaltet!");
Motor[veh] = 0;
}
}
}
return 1;
}
stock IsPlayerInArea(playerid,Float:minX,Float:minY,Float:maxX,Float:maxY)
{
new Float:pX,Float:pY,Float:pZ;
GetPlayerPos(playerid,pX,pY,pZ);
if(pX >= minX && pX <= maxX && pY >= minY && pY <= maxY) return 1;
else return 0;
}
Deine Belegung, schreib da doch mal was anderes rein siehe hier
Kannste mir nicht ein beispiel von deins Schicken?
EDITE
if(newkeys == 132)
{
if(IsPlayerConnected(playerid))
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
OnPlayerCommandText(playerid, "/motor");
}
}
}
//Bei OnPlayerKeyStateChange
if(strcmp(cmd, "/motor",true) == 0)
{
if(IsANoTachoVehicle(GetPlayerVehicleID(playerid)))
{
SendClientMessage(playerid, COLOR_GRAD1, "{FFFFFF}Fahrräder haben {FF0000}keinen{FFFFFF} Motor!");
return 1;
}
new newcar = GetPlayerVehicleID(playerid);
// new oldcar = gLastCar[playerid];
TelePos[playerid][0] = 0.0;
TelePos[playerid][1] = 0.0;
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 1;
new engine,lights,alarm,doors,bonnet,boot,objective;
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
if(vid != INVALID_VEHICLE_ID)
{
if(engine == VEHICLE_PARAMS_ON)
{
SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~W~Motor ~r~aus!", 2000, 5);
}
else
{
if(PlayerInfo[playerid][pAdmin] != 0 && AdminDuty[playerid] == 1)
{
SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~W~Motor ~g~an!", 2000, 5);
return 1;
}
SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~W~Motor ~g~an!", 2000, 5);
}
}
return 1;
}
mfg