Klappt der /test Befehl?
[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
-
-
-
Nutzt du im Gamemode noch einen anderen Command Prozessor (zum Beispiel zcmd)?
Hast du irgendwelche Filterscripts am laufen?Ich nehme an, dass eines von beidem die Ausführung von OnPlayerCommandText im Gamemode verhindert.
-
-
Ja, weil vor allem zcmd die Ausführung von OnPlayerCommandText verhindert. Ändere die beiden Befehle mal zu einem Command Prozessor Befehl den du nutzt.
-
Habe es auf ZCMD umgeschrieben und nun klappt das Ganze. Nur passt irgendwo etwas nicht, weil ich beim Klicken eines Textdraws (z.B. Server Name ändern) nichts passiert, wobei ich das vom FilterScript eigentlich 1:1 übernommen habe. Ich vermute selbst das dass Problem noch was mit OnPlayerCommandText zu tun hat, nur finde ich den Fehler nicht.
Ich weiß nicht genau welchen Code du/ihr benötigt um zu schauen woran der Fehler liegt, aber ich zeige einfach mal ein Auschnitt aus OnDialogResponse.
(Sorry wenn es bisschen größer ist als normal, aber das ist der größte von allen und dafür möchte ich nicht extra ein Thema erstellen.
PS: Ich weiß nicht ob ich den QuellCode richtig verwende, wenn nicht bitte darauf hinweisen :)!C
Alles anzeigenpublic OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == 32764) { if(response == 0){} else if(response == 1) { new rconcp_str[450]; switch(listitem) { case 0://Spieler vom Server kicken { format(rconcp_str,11,"kick %d",GetPVarInt(playerid,"RCONCP_CLICKEDPLAYER")); SendRconCommand(rconcp_str); } case 1://Spieler vom Server bannen { format(rconcp_str,11,"ban %d",GetPVarInt(playerid,"RCONCP_CLICKEDPLAYER")); SendRconCommand(rconcp_str); } case 2://Spieler Connect-Informationen { new RCONCP_ID = GetPVarInt(playerid,"RCONCP_CLICKEDPLAYER"); format(rconcp_str,sizeof(rconcp_str),"{FFFFFF}Connect-Informations of {FF0000}%s{FFFFFF}\n\nConnected since %d Seconds\nBytes send: %d | Bytes recived: %d\nThis player has a packet loss of %.2f percent." ,RCONCP_NAME(RCONCP_ID),floatround(NetStats_GetConnectedTime(RCONCP_ID)/1000,floatround_round),NetStats_BytesSent(RCONCP_ID),NetStats_BytesReceived(RCONCP_ID),NetStats_PacketLossPercent(RCONCP_ID)); ShowPlayerDialog(playerid,32763,DIALOG_STYLE_MSGBOX,"RCON Control Panel",rconcp_str,"Abort",""); SendClientMessage(playerid,0xFFFFFFFF,rconcp_str); } case 3://Spieler Informationen { new RCONCP_ID = GetPVarInt(playerid,"RCONCP_CLICKEDPLAYER"); new Float:rconCPLife[2], Float:rconCPPos[4], rconCPWeap[13][2], rconCPWeapStr[2][312]; GetPlayerHealth(RCONCP_ID,rconCPLife[0]); GetPlayerArmour(RCONCP_ID,rconCPLife[1]); GetPlayerPos(RCONCP_ID,rconCPPos[0],rconCPPos[1],rconCPPos[2]); GetPlayerFacingAngle(RCONCP_ID,rconCPPos[3]); for(new weaps = 0; weaps <= 12; weaps++) { GetPlayerWeaponData(RCONCP_ID, weaps, rconCPWeap[weaps][0], rconCPWeap[weaps][1]); format(rconCPWeapStr[1],310,"\nID: %d - Rounds: %d",rconCPWeap[weaps][0],rconCPWeap[weaps][1]); strcat(rconCPWeapStr[0],rconCPWeapStr[1]); } format(rconcp_str,sizeof(rconcp_str),"{FFFFFF}Informations of {FF0000}%s{FFFFFF}\n\nMoney: %d$ | Score: %d | SkinID: %d\nHealth: %.2f - Armour: %.2f\nPosition: %.4f , %.4f , %.4f - Angle at %.4f\n\n{FF0000}This player got following weapon data:{FFFFFF}%s" ,RCONCP_NAME(RCONCP_ID),GetPlayerMoney(RCONCP_ID),GetPlayerScore(RCONCP_ID),GetPlayerSkin(RCONCP_ID),rconCPLife[0],rconCPLife[1],rconCPPos[0],rconCPPos[1],rconCPPos[2],rconCPPos[3],rconCPWeapStr[0]); ShowPlayerDialog(playerid,9982,DIALOG_STYLE_MSGBOX,"RCON Control Panel",rconcp_str,"Abort",""); } } } } else if(dialogid == 32765) { if(response == 0){} else if(response == 1) { if(GetPVarInt(playerid,"RCONCP_CHANGE") == 14) { SendClientMessageToAll(0xFFFFFFFF,"RCONCP: The server is restarting now!"); SendRconCommand("gmx"); TogglePlayerControllable(playerid, true); } else if(GetPVarInt(playerid,"RCONCP_CHANGE") == 15) { SendClientMessageToAll(0xFFFFFFFF,"RCONCP: The server is shutting down now!"); SendRconCommand("exit"); TogglePlayerControllable(playerid, true); } } } else if(dialogid == 32766) { if(response == 0){} else if(response == 1) { new str_changevalue[84]; if(GetPVarInt(playerid,"RCONCP_CHANGE") == 3) { if(strlen(inputtext) < 0 || strlen(inputtext) > 84)return ShowPlayerDialog(playerid,32766,DIALOG_STYLE_INPUT,"RCON Control Panel","What should be the hostname?\n{FF0000}The Text have to between 1 and 84 characters long.","Change","Back"); format(str_changevalue,sizeof(str_changevalue),"Hostname~n~~r~Now: %s",inputtext); PlayerTextDrawHide(playerid, RCPTD[playerid][3]); PlayerTextDrawSetString(playerid, RCPTD[playerid][3], str_changevalue); PlayerTextDrawShow(playerid, RCPTD[playerid][3]); format(str_changevalue,sizeof(str_changevalue),"hostname %s",inputtext); SendRconCommand(str_changevalue); } else if(GetPVarInt(playerid,"RCONCP_CHANGE") == 4) { if(strlen(inputtext) < 0 || strlen(inputtext) > 84)return ShowPlayerDialog(playerid,32766,DIALOG_STYLE_INPUT,"RCON Control Panel","What should be the gamemodetext?\n{FF0000}The Text have to between 1 and 84 characters long.","Change","Back"); format(str_changevalue,sizeof(str_changevalue),"Gamemodetext~n~~r~Now: %s",inputtext); PlayerTextDrawHide(playerid, RCPTD[playerid][4]); PlayerTextDrawSetString(playerid, RCPTD[playerid][4], str_changevalue); PlayerTextDrawShow(playerid, RCPTD[playerid][4]); format(str_changevalue,sizeof(str_changevalue),"gamemodetext %s",inputtext); SendRconCommand(str_changevalue); } else if(GetPVarInt(playerid,"RCONCP_CHANGE") == 5) { if(strlen(inputtext) < 0 || strlen(inputtext) > 84)return ShowPlayerDialog(playerid,32766,DIALOG_STYLE_INPUT,"RCON Control Panel","What should be the mapname?\n{FF0000}The Text have to between 1 and 84 characters long.","Change","Back"); format(str_changevalue,sizeof(str_changevalue),"Mapname~n~~r~Now: %s",inputtext); PlayerTextDrawHide(playerid, RCPTD[playerid][5]); PlayerTextDrawSetString(playerid, RCPTD[playerid][5], str_changevalue); PlayerTextDrawShow(playerid, RCPTD[playerid][5]); format(str_changevalue,sizeof(str_changevalue),"mapname %s",inputtext); SendRconCommand(str_changevalue); } else if(GetPVarInt(playerid,"RCONCP_CHANGE") == 6) { if(strlen(inputtext) < 0 || strlen(inputtext) > 84)return ShowPlayerDialog(playerid,32766,DIALOG_STYLE_INPUT,"RCON Control Panel","What should be the weburl?\n{FF0000}The Text have to between 1 and 84 characters long.","Change","Back"); format(str_changevalue,sizeof(str_changevalue),"WebURL~n~~r~Now: %s",inputtext); PlayerTextDrawHide(playerid, RCPTD[playerid][6]); PlayerTextDrawSetString(playerid, RCPTD[playerid][6], str_changevalue); PlayerTextDrawShow(playerid, RCPTD[playerid][6]); format(str_changevalue,sizeof(str_changevalue),"weburl %s",inputtext); SendRconCommand(str_changevalue); } else if(GetPVarInt(playerid,"RCONCP_CHANGE") == 7) { if(strlen(inputtext) < 0 || strlen(inputtext) > 84)return ShowPlayerDialog(playerid,32766,DIALOG_STYLE_INPUT,"RCON Control Panel","What should be the rcon-password?\n{FF0000}The Text have to between 1 and 84 characters long.","Change","Back"); format(str_changevalue,sizeof(str_changevalue),"RCON Passwort~n~~r~Now: %s",inputtext); PlayerTextDrawHide(playerid, RCPTD[playerid][7]); PlayerTextDrawSetString(playerid, RCPTD[playerid][7], str_changevalue); PlayerTextDrawShow(playerid, RCPTD[playerid][7]); format(str_changevalue,sizeof(str_changevalue),"rcon_password %s",inputtext); SendRconCommand(str_changevalue); } else if(GetPVarInt(playerid,"RCONCP_CHANGE") == 8) { if(strlen(inputtext) < 0 || strlen(inputtext) > 84)return ShowPlayerDialog(playerid,32766,DIALOG_STYLE_INPUT,"RCON Control Panel","Which gamemode do you want to load (Name without .amx)?\n{FF0000}The Text have to between 1 and 84 characters long.","Load","Back"); format(str_changevalue,sizeof(str_changevalue),"changemode %s",inputtext); SendRconCommand(str_changevalue); } else if(GetPVarInt(playerid,"RCONCP_CHANGE") == 9) { if(strlen(inputtext) < 0 || strlen(inputtext) > 84)return ShowPlayerDialog(playerid,32766,DIALOG_STYLE_INPUT,"RCON Control Panel","Insert a message, wich you want to send global as admin.\n{FF0000}The Text have to between 1 and 84 characters long.","Send","Back"); format(str_changevalue,sizeof(str_changevalue),"say %s",inputtext); SendRconCommand(str_changevalue); } else if(GetPVarInt(playerid,"RCONCP_CHANGE") == 10) { if(strlen(inputtext) < 0 || strlen(inputtext) > 84)return ShowPlayerDialog(playerid,32766,DIALOG_STYLE_INPUT,"RCON Control Panel","Which IP-Adress you want to ban?\n{FF0000}The Text have to between 1 and 84 characters long.","Ban","Back"); format(str_changevalue,sizeof(str_changevalue),"RCONCP: The IP-Adress '%s' is now banned.",inputtext); SendClientMessage(playerid,0xFFFFFFFF,str_changevalue); format(str_changevalue,sizeof(str_changevalue),"banip %s",inputtext); SendRconCommand(str_changevalue); } else if(GetPVarInt(playerid,"RCONCP_CHANGE") == 11) { if(strlen(inputtext) < 0 || strlen(inputtext) > 84)return ShowPlayerDialog(playerid,32766,DIALOG_STYLE_INPUT,"RCON Control Panel","Which IP-Adress you want to unban?\n{FF0000}The Text have to between 1 and 84 characters long.","Unban","Back"); format(str_changevalue,sizeof(str_changevalue),"RCONCP: The IP-Adress '%s' is not longer banned.",inputtext); SendClientMessage(playerid,0xFFFFFFFF,str_changevalue); format(str_changevalue,sizeof(str_changevalue),"unbanip %s",inputtext); SendRconCommand(str_changevalue); } else if(GetPVarInt(playerid,"RCONCP_CHANGE") == 13) { if(strlen(inputtext) < 0 || strlen(inputtext) > 84)return ShowPlayerDialog(playerid,32766,DIALOG_STYLE_INPUT,"RCON Control Panel","Which gravity you wand to set (Default 0.008)?\n{FF0000}The Text have to between 1 and 84 characters long.","Change","Back"); format(str_changevalue,sizeof(str_changevalue),"RCONCP: The gravity was setted to '%f'.",inputtext); SendClientMessage(playerid,0xFFFFFFFF,str_changevalue); format(str_changevalue,sizeof(str_changevalue),"gravity %f",inputtext); SendRconCommand(str_changevalue); } else if(GetPVarInt(playerid,"RCONCP_CHANGE") == 16) { if(strlen(inputtext) < 0 || strlen(inputtext) > 84)return ShowPlayerDialog(playerid,32766,DIALOG_STYLE_INPUT,"RCON Control Panel","Which filterscript you want to load (Name without .amx)?\n{FF0000}The Text have to between 1 and 84 characters long.","Load","Back"); format(str_changevalue,sizeof(str_changevalue),"loadfs %s",inputtext); SendRconCommand(str_changevalue); } else if(GetPVarInt(playerid,"RCONCP_CHANGE") == 17) { if(strlen(inputtext) < 0 || strlen(inputtext) > 84)return ShowPlayerDialog(playerid,32766,DIALOG_STYLE_INPUT,"RCON Control Panel","Which filterscript you want to unload (Name without .amx)?\n{FF0000}The Text have to between 1 and 84 characters long.","Unload","Back"); format(str_changevalue,sizeof(str_changevalue),"unloadfs %s",inputtext); SendRconCommand(str_changevalue); } } } return 0; }
-
server.p(315) : error 032: array index out of bounds (variable "pFrak")
server.p(327) : error 032: array index out of bounds (variable "pFrak")Code
Alles anzeigenenum Fraktion{ Zivilist, LSPD, Triaden } new pFrak[MAX_PLAYERS][Fraktion]; if(fexist(string2)){ dini_Get(string2, "Spielername"); dini_Int(string2, "Level "); dini_Int(string2, "Geld "); dini_Int(string2, "Skin "); dini_Int(string2, "Adminlevel "); dini_Int(string2, "Leader"); dini_Int(string2, "Logged"); dini_Int(string2, "Kills"); dini_Int(string2, "Tode"); dini_Set(string2, "Fraktion", pFrak[playerid][Fraktion]); // <---- HIER IST DER FEHLER }else{ dini_Create(string2); dini_Set(string2, "Spielername", PlayerName); dini_IntSet(string2, "Level ", GetPlayerScore(playerid)); dini_IntSet(string2, "Geld ", GetPlayerMoney(playerid)); dini_IntSet(string2, "Skin ", GetPlayerSkin(playerid)); dini_IntSet(string2, "Adminlevel ", 0); dini_IntSet(string2, "Leader", 0); dini_IntSet(string2, "Logged", 0); dini_IntSet(string2, "Kills", pKills[playerid]); dini_IntSet(string2, "Tode", pDeaths[playerid]); dini_Set(string2, "Fraktion", pFrak[playerid][Fraktion]); // <---- HIER IST DER FEHLER }
Hab das Gefühl liegt an DINI. Naja, hab das Problem seit 1-2 Wochen, bisher keine Lösung gefunden.. -
Mache es so:
C
Alles anzeigenif(fexist(string2)){ dini_Get(string2, "Spielername"); dini_Int(string2, "Level "); dini_Int(string2, "Geld "); dini_Int(string2, "Skin "); dini_Int(string2, "Adminlevel "); dini_Int(string2, "Leader"); dini_Int(string2, "Logged"); dini_Int(string2, "Kills"); dini_Int(string2, "Tode"); dini_Set(string2, "Fraktion", pFrak[playerid]); }else{ dini_Create(string2); dini_Set(string2, "Spielername", PlayerName); dini_IntSet(string2, "Level ", GetPlayerScore(playerid)); dini_IntSet(string2, "Geld ", GetPlayerMoney(playerid)); dini_IntSet(string2, "Skin ", GetPlayerSkin(playerid)); dini_IntSet(string2, "Adminlevel ", 0); dini_IntSet(string2, "Leader", 0); dini_IntSet(string2, "Logged", 0); dini_IntSet(string2, "Kills", pKills[playerid]); dini_IntSet(string2, "Tode", pDeaths[playerid]); dini_Set(string2, "Fraktion", pFrak[playerid]); }
@[LnD]JustMe.77 Mache bitte einen Thread auf. -
mit welcher Funktion fragt man ab ob man nur Zahlen eingeben hat oder nur Buchstaben und keine Zahlen. -> mit strval fragt man ab ob man Zahlen eingeben hat ja , aber wenn ich zb 515153465GRAWSD also Buchstaben hintersetzte geht das dennoch.
-
-
-
mit strval fragt man ab ob man Zahlen eingeben hat
Nicht ganz. Die Funktion strval konvertiert einen String nur zu einer Zahl, da empfiehlt sich die Funktion "IsNumeric" besser.
Mit dieser Funktion kannst du abfragen, ob der String nur aus Zahlen besteht.
Wenn nur Zahlen enthalten sind, dann gibt IsNumeric true (1) zurück. -
Gibt es ein Tool womit ich Texte an Autos packen kann? ( Ingame oder so )
-
Warum bekommt man keinen Platten?
Code
Alles anzeigenpublic OnUnoccupiedVehicleUpdate(vehicleid,playerid,passenger_seat) { if(IsPlayerInAnyVehicle(playerid)) { for(new i=0;i<MAX_NAGELBAENDER;i++) { if(NagelBand[i][Erstellt] == 1) { if(IsPlayerInRangeOfPoint(playerid,2.0,NagelBand[i][sperreX],NagelBand[i][sperreY],NagelBand[i][sperreZ])) { UpdateVehicleDamageStatus(vehicleid,0, 0, 0, encode_tires(1, 1, 1, 1)); } } }} return 1; }
-
Warum bekommt man keinen Platten?
Code
Alles anzeigenpublic OnUnoccupiedVehicleUpdate(vehicleid,playerid,passenger_seat) { if(IsPlayerInAnyVehicle(playerid)) { for(new i=0;i<MAX_NAGELBAENDER;i++) { if(NagelBand[i][Erstellt] == 1) { if(IsPlayerInRangeOfPoint(playerid,2.0,NagelBand[i][sperreX],NagelBand[i][sperreY],NagelBand[i][sperreZ])) { UpdateVehicleDamageStatus(vehicleid,0, 0, 0, encode_tires(1, 1, 1, 1)); } } }} return 1; }
OnUnoccupiedVehicleUpdateUnoccupied = Ohne Fahrer
Kannst entweder [wiki]OnPlayerUpdate[/wiki]oder einen Timer verwenden.
-
-
Du darfst nicht mit [playerid] auf das Nagelband zugreifen, sondern musst die Schleife nehmen, gleich wie zuvor, nur nicht in dem Callback.
-
Warum wird das nicht geupdatet?
Code
Alles anzeigenBusinessInfo[biz][BizPickup4] = CreateDynamicObject(5811,BusinessInfo[biz][TSchildX],BusinessInfo[biz][TSchildY],BusinessInfo[biz][TSchildZ],0.0,0.0,0.0,-1,-1,-1,500.0); format(stringschild4,sizeof(stringschild4),""#HTML_RED"Zweitakt: "#HTML_WHITE"%d$",BusinessInfo[biz][zweitakt]); SetDynamicObjectMaterialText(BusinessInfo[biz][BizPickup4],5,stringschild4,80,"Arial",24,1,-1,-16777216,1); format(stringschild2,sizeof(stringschild2),""#HTML_RED"Benzin: "#HTML_WHITE"%d$",BusinessInfo[biz][Benzin]); SetDynamicObjectMaterialText(BusinessInfo[biz][BizPickup4],4,stringschild2,80,"Arial",24,1,-1,-16777216,1); format(stringschild1,sizeof(stringschild1),""#HTML_RED"Diesel: "#HTML_WHITE"%d$",BusinessInfo[biz][Diesel]); SetDynamicObjectMaterialText(BusinessInfo[biz][BizPickup4],3,stringschild1,80,"Arial",24,1,-1,-16777216,1); format(stringschild3,sizeof(stringschild3),""#HTML_RED"Super: "#HTML_WHITE"%d$",BusinessInfo[biz][SuperPlus]); SetDynamicObjectMaterialText(BusinessInfo[biz][BizPickup4],2,stringschild3,80,"Arial",24,1,-1,-16777216,1); format(stringschild5,sizeof(stringschild5),""#HTML_RED""#SERVERTAG" Sprit: "#HTML_WHITE"%d$",BusinessInfo[biz][sprit]); SetDynamicObjectMaterialText(BusinessInfo[biz][BizPickup4],1,stringschild5,80,"Arial",24,1,-1,-16777216,1);
-
Warum bekomme ich diese Error´s?
CodeC:\Users\Media Markt\Desktop\German-Elite-Reallife\German-Elite-Reallife\filterscripts\Hsirene.pwn(81) : error 017: undefined symbol "vehicleid" C:\Users\Media Markt\Desktop\German-Elite-Reallife\German-Elite-Reallife\filterscripts\Hsirene.pwn(82) : error 017: undefined symbol "vehicleid" C:\Users\Media Markt\Desktop\German-Elite-Reallife\German-Elite-Reallife\filterscripts\Hsirene.pwn(83) : error 017: undefined symbol "vehicleid" Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase 3 Errors.
-
Poste bitte deinen Code.
Der Grund ist eine fehlende Deklaration von "vehicleid".
-
Code
Alles anzeigenocmd:hsirene(playerid,params[]) { { if(HSirene[playerid] == 0) { new vehicleid=GetPlayerVehicleID(playerid); HSirene[playerid] = 1; FlashTime[vehicleid] = SetTimerEx("OnLightFlash", flashtime, true, "d", vehicleid); SendClientMessage(playerid,0xFFFFFFAA,"H-Sirene An"); return 1; } else if(HSirene[playerid] == 1) { HSirene[playerid] = 0; new panels, doors, lights, tires; KillTimer(FlashTime[vehicleid]); GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires); UpdateVehicleDamageStatus(vehicleid, panels, doors, 0, tires); SendClientMessage(playerid,0xFFFFFFAA,"H-Sirene Aus"); return 1; } } return 1; }