Ändere das hier:
DestroyObject(supsirene[GetPlayerVehicleID(playerid)]);
zu:
DestroyObject(supsirene[supmobil[playerid]]);
[SAMMELTHREAD] Kleine Scripting Fragen
- Rafelder
- Unerledigt
Dein Problem konnte durch einen User gelöst werden? Bedank dich bei ihm indem du seinen Beitrag als Hilfreich markierst sowie einen Daumen oben dalässt
Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!
Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
-
-
Funktioniert immer noch nicht ?
-
Hast du es bei allen anderen auch geändert?
Wenn nicht:
if(dialogid==DIALOG_SUPMOBIL)
{
if(!response)return 1;
new Float:p[4];
GetPlayerPos(playerid,p[0],p[1],p[2]),GetPlayerFacingAngle(playerid,p[3]);
switch(listitem)
{
case 0:
{
supmobil[playerid] = CreateVehicle(560,p[0],p[1],p[2],p[3],79,79,-1);
SetVehicleNumberPlate(supmobil[playerid],"Supmobil");
tank[supmobil[playerid]] = 100;
/*supsirene[supmobil[playerid]] = CreateObject(18646,0,0,-1000,0,0,0,100);
AttachObjectToVehicle(supsirene[supmobil[playerid]],supmobil[playerid],-0.54, 0.1, 0.88, 0.0, 0.0, 0.0);*/
supsirene[supmobil[playerid]] = CreateObject(19620,0,0,-1000,0,0,0,100);
AttachObjectToVehicle(supsirene[supmobil[playerid]],supmobil[playerid],-0.54, 0.1, 0.88, 0.0, 0.0, 0.0);
PutPlayerInVehicle(playerid,supmobil[playerid],0);
printf("%s %s hat sich den Sultan als Supmobil gespawnt!)",arang(playerid),getPlayerName(playerid));
}
case 1:
{
supmobil[playerid] = CreateVehicle(415,p[0],p[1],p[2],p[3],79,79,-1);
SetVehicleNumberPlate(supmobil[playerid],"Supmobil");
tank[supmobil[playerid]] = 100;
supsirene[supmobil[playerid]] = CreateObject(18646,0,0,-1000,0,0,0,100);
AttachObjectToVehicle(supsirene[supmobil[playerid]],supmobil[playerid],-0.45, -0.2, 0.66, 0.0, 0.0, 0.0);
PutPlayerInVehicle(playerid,supmobil[playerid],0);
printf("%s %s hat sich den Cheetah als Supmobil gespawnt!)",arang(playerid),getPlayerName(playerid));
}
case 2:
{
supmobil[playerid] = CreateVehicle(495,p[0],p[1],p[2],p[3],79,79,-1);
SetVehicleNumberPlate(supmobil[playerid],"Supmobil");
tank[supmobil[playerid]] = 100;
supsirene[supmobil[playerid]] = CreateObject(18646,0,0,-1000,0,0,0,100);
AttachObjectToVehicle(supsirene[supmobil[playerid]],supmobil[playerid],-0.5, -0.2, 1.04, 0.0, 0.0, 0.0);
PutPlayerInVehicle(playerid,supmobil[playerid],0);
printf("%s %s hat sich den Sandking als Supmobil gespawnt!)",arang(playerid),getPlayerName(playerid));
}
}
}Vor allem, weil du den Spieler erst danach in das Fahrzeug setzt.
-
Mein Startwar Befehl buggt rum. Bzw manchmal steht da "unknwon command" dann wenn ich etwas mit // deaktiviere dann steht manchmal "Du bist in keinem Gebiet" ect.. kann einer sagen wo mein Fehler liegt ?
Jeffry und Co

COMMAND:startwar(playerid,params[])
{
#pragma unused params
new string[128],GegnerOnline = 0,TempZone = GetPlayerFightzone(playerid);
if(ImTutorial[playerid] != 0)return SendClientMessage(playerid,GRAU,"Du kannst keine Befehle nutzen,da du im Tutorial bist.");
if(GetPVarInt(playerid,"Eingeloggt") == 0)return SendClientMessage(playerid,GRAU,"Du bist nicht eingeloggt!");
if(Spieler[playerid][pAWAYFROMKEYBOARD] == 1)return SendClientMessage(playerid,WRONGCMD,"Du bist im AFK-Modus und kannst somit keine Befehle nutzen."),SendClientMessage(playerid,WRONGCMD,"BENUTZE: /back");
if(Spieler[playerid][pInPrison] == 1)return SendClientMessage(playerid,GRAU,"Du bist im Prison.");
if(Spieler[playerid][pFriedhof] == 1)return SendClientMessage(playerid,GRAU,"Du bist Tot.");
if(Spieler[playerid][pDeath] == 1)return SendClientMessage(playerid,GRAU,"Du bist verletzt.");
if(Spieler[playerid][pJailed] != 0)return SendClientMessage(playerid,GRAU,"Du bist im Gefängnis.");
if(Spieler[playerid][pTazerd] == 1)return SendClientMessage(playerid,GRAU,"Du bist K.O/getazert.");
if(Spieler[playerid][pCuffed] == 1)return SendClientMessage(playerid,GRAU,"Du bist gefesselt.");
if(isPlayerInFrakt(playerid,4) || isPlayerInFrakt(playerid,5) || isPlayerInFrakt(playerid,7) || isPlayerInFrakt(playerid,9) || isPlayerInFrakt(playerid,12) || isPlayerInFrakt(playerid,13) || isPlayerInFrakt(playerid,17) || isPlayerInFrakt(playerid,18))
{
gettime(stunde,minute,sekunde);
if(stunde<13||stunde>23)return SendClientMessage(playerid,GRAU,"Man kann ein Gangwar erst zwischen 13 - und 24 Uhr starten.");
if(!isPlayerAMember(playerid,6))return SendClientMessage(playerid,GRAU,"Du besitzt nicht den jeweiligen Rang.");
if(IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,GRAU,"Du bist in einem Fahrzeug!");
if(IsAFightFaction(GetPlayerFaction(playerid)))
{
for(new fs;fs<sizeof(GangwarZones);fs++)
{
if((GangwarZones[fs][GW_OwnerFaction] == GetPlayerFaction(playerid) && GangwarZones[fs][GW_FightTime]) || GangwarZones[fs][GW_AttackFaction] == GetPlayerFaction(playerid))
return SendClientMessage(playerid,GRAU,"Deine Gang / Mafia ist bereits in einem Fight.");
}
ForEachPlayer(i)
{
if(IsPlayerConnected(i))
{
if(isPlayerInFrakt(i,GangwarZones[TempZone][GW_OwnerFaction]))
{
GegnerOnline++;
}
}
}
if(GegnerOnline < 3)return SendClientMessage(playerid,GRAU,"Nicht genug Gegner Online. (mindestens 3 Gegner!)");
if(TempZone != -255)
{
if(GangwarZones[TempZone][GW_FightTimeCool] != 0)
{
format(string, sizeof(string), "Das Gebiet kann erst wieder in ca. %d Minuten erobert werden.", GangwarZones[TempZone][GW_FightTimeCool]);
return SendClientMessage(playerid, GRAU,string);
}
if(!IsAFightFaction(GangwarZones[TempZone][GW_OwnerFaction]))
return SendClientMessage(playerid,GRAU,"Gebiet wurde ausgeschaltet.");
if(GangwarZones[TempZone][GW_OwnerFaction] == GetPlayerFaction(playerid))
return SendClientMessage(playerid,GRAU,"Man greift nicht seine eigenen Leute an.");
if(GangwarZones[TempZone][GW_FightTime] || GangwarZones[TempZone][GW_AttackFaction] != -255)
return SendClientMessage(playerid,GRAU,"In diesem Gebiet wird bereits geschossen.");
if(GangwarZones[TempZone][GW_LastFight])
{
new fsText[178];
format(fsText,sizeof(fsText),"Ganggebiet: Dieses Ganggebiet wurde bereits Angegriffen, wartet noch: '%d' Minuten.",GangwarZones[TempZone][GW_LastFight]);
SendClientMessage(playerid,GRAU,fsText);
return 1;
}
for(new fs;fs<sizeof(GangwarZones);fs++)
{
if(GangwarZones[fs][GW_OwnerFaction] == GangwarZones[TempZone][GW_OwnerFaction] && (GangwarZones[fs][GW_FightTime] || GangwarZones[fs][GW_AttackFaction] != -255))
return SendClientMessage(playerid,GRAU,"Ganggebiet: Die gegnerische Fraktion hat bereits einen Kampf.");
}
new fsTextToOwner[255];
format(fsTextToOwner,sizeof(fsTextToOwner),"Ihr werdet von der Fraktion %s angegriffen! GebietInfo: %s",GetFactionNameOfFaction(GetPlayerFaction(playerid)),GangwarZones[TempZone][GW_Zone_Name]);
new fsName[MAX_PLAYER_NAME];
GetPlayerName(playerid,fsName,MAX_PLAYER_NAME);
new fsTextToAttack[255];
format(fsTextToAttack,sizeof(fsTextToAttack),"Gangfight: %s hat einen Kampf gegen die Fraktion %s gestartet.",GetFactionNameOfFaction(GetPlayerFaction(playerid)),GetFactionNameOfFaction(GangwarZones[TempZone][GW_OwnerFaction]));
new fsText[64];
format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(GangwarZones[TempZone][GW_OwnerFaction]));
TextDrawSetString(GangwarZones[TempZone][GW_WinFaction],fsText);
TextDrawSetString(GangwarZones[TempZone][GW_WinKills],"~y~0 Kills");
format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(GetPlayerFaction(playerid)));
TextDrawSetString(GangwarZones[TempZone][GW_LoseFaction],fsText);
TextDrawSetString(GangwarZones[TempZone][GW_LoseKills],"~y~0 Kills");
TextDrawSetString(GangwarZones[TempZone][GW_Time],"Verbl. Zeit: 60 Minuten");//ZEIT
for(new i;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
GangZoneFlashForPlayer(i,GangwarZones[TempZone][GW_ZoneID],GetZoneColorOfFaction(GetPlayerFaction(playerid)));
if(GetPlayerFaction(i) == GangwarZones[TempZone][GW_OwnerFaction])
{
PlayerPlaySound(i,1058,0.0,0.0,0.0);
SendClientMessage(i,ROT,fsTextToOwner);
TextDrawShowForPlayer(i,Fight);
TextDrawShowForPlayer(i,FightUnderline);
TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_WinFaction]);
TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_WinKills]);
TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_LoseFaction]);
TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_LoseKills]);
TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_Time]);
}
if(GetPlayerFaction(i) == GetPlayerFaction(playerid))
{
PlayerPlaySound(i,1058,0.0,0.0,0.0);
SendClientMessageToAll(GW_COLOR_ORANGE,fsTextToAttack);
TextDrawShowForPlayer(i,Fight);
TextDrawShowForPlayer(i,FightUnderline);
TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_WinFaction]);
TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_WinKills]);
TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_LoseFaction]);
TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_LoseKills]);
TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_Time]);
}
}
}
GangwarZones[TempZone][GW_AttackFaction] = GetPlayerFaction(playerid);
GangwarZones[TempZone][GW_KillsOfOwner] = 0;
GangwarZones[TempZone][GW_KillsOfAttack] = 0;
GangwarZones[TempZone][GW_FightTime] = FIGHT_TIME;
GangwarZones[TempZone][GW_CtfOfOwner][0] = -255;
GangwarZones[TempZone][GW_CtfOfOwner][1] = 0;
GangwarZones[TempZone][GW_CtfOfAttack][0] = -255;
GangwarZones[TempZone][GW_CtfOfAttack][1] = 0;
GangwarZones[TempZone][GW_Started] = 1;
return 1;
}return SendClientMessage(playerid,GRAU,"Du bist in keinem Gebiet!");
}else SendClientMessage(playerid,GRAU,"Du bist in keiner Gang / Mafia."); return 1;
}return SendClientMessage(playerid,GRAU,"Du bist nicht in der jeweiligen Fraktion.");
} -
Eröffne doch dafür ein Topic, das ist keine kleine Frage mehr..
Kann mir jemand sagen ob man in SAMP das Wetter ändern lassen kann wenn man ein bestimmtes Gebiet betretet?
Habe vor verschiedene Wetter in den Städten LS, SF & LV zu haben. -
Kann mir jemand sagen ob man in SAMP das Wetter ändern lassen kann wenn man ein bestimmtes Gebiet betretet?
http://forum.sa-mp.com/showthread.php?t=181897
oder:
http://forum.sa-mp.com/showthread.php?t=170552 -
Eröffne doch dafür ein Topic, das ist keine kleine Frage mehr..
Kann mir jemand sagen ob man in SAMP das Wetter ändern lassen kann wenn man ein bestimmtes Gebiet betretet?
Habe vor verschiedene Wetter in den Städten LS, SF & LV zu haben.
hier ist ein COde für LS/SF/LVif((xx > -992.5172 && xx < 4000.0000) && (yy < 528.0000 && yy > -4000.0000)) SetPlayerWeather(i, Weather[0]), printf("Setze Wetter für %d zu %d in LS", i, Weather[0]);//LS
if((xx > -4000.0000 && xx< -992.5172) && (yy < 4000.0000 && yy > -4000.0000)) SetPlayerWeather(i, Weather[1]), printf("Setze Wetter für %d zu %d in SF", i, Weather[1]);//SF
if((xx > -992.5172 && xx< 4000.0000) && (yy < 4000.0000 && yy > 528.0000)) SetPlayerWeather(i, Weather[2]), printf("Setze Wetter für %d zu %d in LV", i, Weather[2]);//LV -
tayson87:
Das sieht mir stark danach aus, dass du ein Array sprengst.
Lade dir das Crashdetect Plugin herunter und füge es in deinen Server ein: http://forum.sa-mp.com/showthread.php?t=262796
Dann erstelle in dem /pawno/ Ordner neben der pawno.exe eine "pawn.cfg" Datei und schreibe dort "-d3" rein (ohne die Anführungszeichen). Anschließend öffne die pawno.exe und wähle deinen Code aus, dann kompiliere ihn neu. Wenn du dann den Server neu startest und den Befehl eingibst und Unknown Command kommt, dann bekommst du im Server Log die Fehlermeldung plus die Zeile in der der Fehler ist ausgegeben.
Poste das dann gegebenenfalls in einem neuen Thread, sofern du mit der Meldung nicht klar kommst. -
kann man irgendwie abfragen ob ein Spieler hockt ?sprich sich hingehockt hat mit c ?
-
https://wiki.sa-mp.com/wiki/SpecialActions
SPECIAL_ACTION_DUCK -
-
Ich hab da mal ne kleine frage....
SQLite.pwn(6) : error 001: expected token: "-identifier-", but found "("aber ich habe in der zeile garkein "("
new Bit1: g_PlayerLogged <MAX_PLAYERS>, // Erstellt ein 1 bit array Bit16: g_AdminLevel <MAX_PLAYERS>, // Erstellt ein 16 bit array nochmal. DB: Database;PS: Der pawn bb code ist echt blöd der haut das immer in eine Zeile rein

Pastebin Hier ist es wenigstens alles richtig eingerückt
-
Kann es sein, dass du MAX_PLAYERS mit Klammern deklariert hast?
#define MAX_PLAYERS (500)
Zum Beispiel?Ersetze in deinem Code das MAX_PLAYERS mal mit der gewünschten Zahl.
-
-
ich bekomme bei dieser zeile den Error 17...
Zeig mal mehr von deinem Code und den Header der Funktion
und die vollständige Fehlermeldung wäre schon recht hilfreich

-
Ich hatte mich vertan

Statt OnPlayerSpawn hab ich es bei OnVehicleSpawn hingeschrieben
-
Warum funktionieren meine Health Textdraws nicht? 0 Errors, Ingame wird nur der Health Textdraw angezeigt aber auch ohne funktion sprich das bleibt bei 100 HP auch wenn ich 50 HP habe.
Habe das jetzt selber erstellt als beim letzen mal..
Spoiler anzeigen
#include <a_samp>Spoiler anzeigen new Text:Health[MAX_PLAYERS];
new Text:Armour[MAX_PLAYERS];Spoiler anzeigen public OnFilterScriptInit()
{Spoiler anzeigen SetTimer("vitals",1000,1);Spoiler anzeigen public OnPlayerConnect(playerid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
Health[i] = TextDrawCreate(569.0, 44.0, "100");
TextDrawBackgroundColor(Health[i], 255);
TextDrawFont(Health[i],2);
TextDrawLetterSize(Health[i], 0.220000, 0.899999);
TextDrawColor(Health[i], -65281);
TextDrawSetOutline(Health[i], 0);
TextDrawSetProportional(Health[i], 1);
TextDrawSetShadow(Health[i], 1);
TextDrawSetSelectable(Health[i], 0);Spoiler anzeigen Armour[i] = TextDrawCreate(569.0, 66.0, "100");
TextDrawBackgroundColor(Armour[i], 255);
TextDrawFont(Armour[i], 2);
TextDrawLetterSize(Armour[i], 0.220000, 0.899999);
TextDrawColor(Armour[i], -65281);
TextDrawSetOutline(Armour[i], 0);
TextDrawSetProportional(Armour[i], 1);
TextDrawSetShadow(Armour[i], 1);
TextDrawSetSelectable(Armour[i], 0);
}
return 1;
}Spoiler anzeigen public OnPlayerDisconnect(playerid)
{
return 1;
}Spoiler anzeigen public OnPlayerUpdate(playerid)
{
new Float:pArmour;
GetPlayerArmour(playerid, pArmour);
if(pArmour == 0){
TextDrawHideForPlayer(playerid, Armour[playerid]);
}else{
TextDrawShowForPlayer(playerid, Armour[playerid]);
}
return 1;
} -
Ich hatte dir den Code doch gegeben, mit den PlayerTextDraws. Wenn du es mit normalen Textdraws machst, und diese auch noch bei OnPlayerConnect MAX_PLAYERS mal erstellst, dann sprengst du das Limit.
Mache es mit den PlayerTextDraws, wie ich es dir gegeben habe (Textdraw Design musst du da eventuell anpassen, das habe ich nur von dir übernommen). -
Ich habe es nicht benutzt da ich das alles dann selber erstellt habe, wie jetzt.
Nur wie baue ich jetzt die Funktionen dafür ein? Das sich das alles updatet und nicht nur auf 100 bleibt.
#include <a_samp>new PlayerText:Textdraw0[MAX_PLAYERS];
new PlayerText:Textdraw1[MAX_PLAYERS];public OnPlayerConnect(playerid)
{Textdraw0[playerid] = CreatePlayerTextDraw(playerid,568.000000, 43.000000, "100");
PlayerTextDrawBackgroundColor(playerid,Textdraw0[playerid], 255);
PlayerTextDrawFont(playerid,Textdraw0[playerid], 2);
PlayerTextDrawLetterSize(playerid,Textdraw0[playerid], 0.239999, 1.000000);
PlayerTextDrawColor(playerid,Textdraw0[playerid], 16711935);
PlayerTextDrawSetOutline(playerid,Textdraw0[playerid], 0);
PlayerTextDrawSetProportional(playerid,Textdraw0[playerid], 1);
PlayerTextDrawSetShadow(playerid,Textdraw0[playerid], 1);
PlayerTextDrawSetSelectable(playerid,Textdraw0[playerid], 0);Textdraw1[playerid] = CreatePlayerTextDraw(playerid,568.000000, 65.000000, "100");
PlayerTextDrawBackgroundColor(playerid,Textdraw1[playerid], 255);
PlayerTextDrawFont(playerid,Textdraw1[playerid], 2);
PlayerTextDrawLetterSize(playerid,Textdraw1[playerid], 0.239999, 1.000000);
PlayerTextDrawColor(playerid,Textdraw1[playerid], 16711935);
PlayerTextDrawSetOutline(playerid,Textdraw1[playerid], 0);
PlayerTextDrawSetProportional(playerid,Textdraw1[playerid], 1);
PlayerTextDrawSetShadow(playerid,Textdraw1[playerid], 1);
PlayerTextDrawSetSelectable(playerid,Textdraw1[playerid], 0);return 1;
}
public OnPlayerDisconnect(playerid)
{
PlayerTextDrawDestroy(playerid, Textdraw0[playerid]);
PlayerTextDrawDestroy(playerid, Textdraw1[playerid]);
return 1;
}public OnPlayerSpawn(playerid)
{
PlayerTextDrawShow(playerid, Textdraw0[playerid]);
PlayerTextDrawShow(playerid, Textdraw1[playerid]);
return 1;
} -
Mit einem Timer:
OnGameModeInit:
SetTimer("UpdateHealth", 500, true);Ganz unten im Gamemode:
forward UpdateHealth();
public UpdateHealth()
{
new Float:health, Float:armour, str[10];
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && !IsPlayerNPC(i))
{
GetPlayerHealth(i, health);
format(str, sizeof(str), "%0.0f", health);
PlayerTextDrawSetString(i, Textdraw0[i], str);
GetPlayerArmour(i, armour);
format(str, sizeof(str), "%0.0f", armour);
PlayerTextDrawSetString(i, Textdraw1[i], str);
}
}
return 1;
} -
-