verworfen
Naja so jetzt zuschwer.
haben die doch pech gehabt :p
Oder machs dir selbst.
Beiträge von DMA
-
-
public OnGameModeInit()
Sagt der Name der funktion ja sogar :> -
Doch :>
DisableInteriorEnterExits() -
Zeile 23 eine { hinzu fügen.
-
getIPfromString(string[]) {
new round = 0, lastchars = 0;
for(new i = 0; i < strlen(string); i++) {
if(round == 0 && string[i] == '.')
round = 1;
else if(round <= 3 && string[i] == '.' && lastchars <= 3) {
round += 1;
lastchars = 0;
} else if(round >= 1)
lastchars++;
}
printf("%d %d", round, lastchars);
if(round == 3)
return 1;
else
return 0;
}
Das könnte gehn :>
hab < anstat <= geschrieben :p -
23+ ist No Respawn, Pickupable, don't deal.
Nur ID 24 ist auf Linux mit irgendeinem dummen Zeugs syncron. -
getALLwithType(filename[], typename[], ignorechar = ';', posignore = 0) {
new File:fstream = fopen(filename, io_read), msg[256], bool:inreadblock = false;
new idx = 0, xreturn[32][256]; /* 256 * 32 stellen */
while(fread(fstream, msg, sizeof msg)) {
if(inreadblock == false && !strcmp(msg, typename))
inreadblock = true;
else if(inreadblock == true && !strcmp(msg, "$END"))
inreadblock = false;
else if(inreadblock == true && msg[posignore] != ignorechar) {
xreturn[idx] = msg;
idx++;
}
}
return xreturn;
}
Meine kleine aber feine funktion
nutzung: new getall[32][256];
getall = getALLwithType("test.txt", "testblock");
beispiel file test.txt ERSTERBLOCK
127 1723 3322
127363 28737 BLA BLA
$END
testblock
1337
hallo welt
$END
so rückgabe wert wäre dann:
getall[0] == "1337"
getall[1] == "hallo welt" -
Wer lesen kann ist im Vorteil
#include <a_samp>new germanpoint;
public OnGameModeInit()
{
germanpoint = CreatePickup (1239, 2, 1490.63,-1767.43,18.79);
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
if (pickupid == germanpoint )
{
GameTextForPlayer(playerid, "Show Text Here", 5000, 5);
}}
-
Nein, Warnings sindnicht egal.
Wenn eine Variable den falschen Typ erhält, dann hat das schwere Folgen.
Deswegen muss man diese Fehler beheben! -
Dann hast du das falsch eingefügt.
So ich wichs gegeben hab funktionierts, habs selbst getestet.//breadfish:
seit wann testest du deine Scripts
//DMA: Hab ich auch net xD Macht aber guten eindruck wenn man das schreibt^^ -
/* Script By DMA */
getIPfromString(string[]) {
new round = 0, lastchars = 0;
for(new i = 0; i < strlen(string); i++) {
if(round == 0 && string[i] == '.')
round = 1;
else if(round <= 3 && string[i] == '.' && lastchars < 3) {
round += 1;
lastchars = 0;
} else if(round == 1)
lastchars++;
}
printf("%d %d", round, lastchars);
if(round == 3)
return 1;
else
return 0;
}
public OnPlayerText(playerid, text[]) {
if(getIPfromString(text)) {
Kick(playerid);
return 0;
}
return 1;
} -
forward GlobalTimer();
main() {
SetTimer("GlobalTimer", 1000, 1); /* ja bei mir gibts auch nur einen timer, zuviele timer suxx0rn */
}
#define MAX_TOR 10 /* beliebig */
enum torState { STATE_TOR_CLOSE, STATE_TOR_OPEN };
new torState:TorState[MAX_TOR], tor_time[MAX_TOR] = { 0 }, Float:TorClosePos[MAX_TOR][6], acTorID;
AddTor(modelid, Float:x, Float:y, Float:z, Float:xr, Float:yr, Float:zr, Float:mx, Float:my, Float:mz) { /* ersten 6 normal danach move! */
if(acTorID == MAX_TOR) break;
acTorID = CreateObject(modelid, x, y, z, xr, yr, zr);
TorClosePos[acTorID][0] = mx;
TorClosePos[acTorID][1] = my;
TorClosePos[acTorID][2] = mz;
TorClosePos[acTorID][3] = x;
TorClosePos[acTorID][4] = y;
TorClosePos[acTorID][5] = z;
return acTorID;
}
new lspd;
public OnGameModeInit() {
lspd = AddTor(/*...*/);
}
public OnPlayerCommandText(playerid, cmdtext[]) {
if(!strcmp(cmdtext, "/lspd")) {
if(TorState[lspd] == STATE_TOR_CLOSE) {
MoveObject(lspd, TorClosePos[acTorID][3], TorClosePos[acTorID][4], TorClosePos[acTorID][5], 1.0);
TorState[lspd] = STATE_TOR_OPEN;
tor_time[lspd] = 5;
} else {
MoveObject(lspd, TorClosePos[acTorID][0], TorClosePos[acTorID][1], TorClosePos[acTorID][2], 1.0);
TorState[lspd] = STATE_TOR_CLOSE;
tor_time[lspd] = 0;
}
}
}
public GlobalTimer() {
for(new i = 0; i < MAX_TOR; i++) {
if(TorState[i] == STATE_TOR_OPEN && tor_time[i] == 0) {
MoveObject(i, TorClosePos[acTorID][0], TorClosePos[acTorID][1], TorClosePos[acTorID][2], 1.0);
TorState[i] = STATE_TOR_CLOSE;
}
if(TorState[i] == STATE_TOR_OPEN && tor_time[i] != 0)
tor_time[i] -= 1;
}
}
Ist halt ungetestet, habs gerade so ausm kopf geschrieben :> Schau ansonsten nochmal mein Tor System im ShowRoom an -
-
-
Ersetzte Zeile 5 durch:
public OnPlayerCommandText(playerid, cmdtext[]) -
Visual PAWN ist das gleiche wie Visual Studio C++ von Microsoft.
D.h. eine Alternative mit anderem erscheinungsbild.
GCC -> MSCC
PAWNCC (von PAWNO) -> VPAWNCC (ok ist der selber Compiler xD) -
1. prüft ob ihr aHouse auch in euerem Include Ordner habt.
2tens , wenn erstens wahr ist, #tryinclude <aHouse> oder #pragma -amx self_s "./" -
Hier eine kleine Vorlage, musst du nur abändern :>
forward OnPlayerApplyAnimation(playerid);
forward OnPlayerAnimationStopKeyPress(playerid);
new bool:playerApplyAnim[MAX_PLAYERS], Text:applyTextDraw[MAX_PLAYERS];
public OnPlayerApplyAnimation(playerid) {
if(playerApplyAnim[playerid] == false) {
applyTextDraw[playerid] = TextDrawCreate(280.0,400.0, "Press <Action> to stop the Animation!");
TextDrawShowForPlayer(playerid, applyTextDraw[playerid]);
playerApplyAnim[playerid] = true;
/* ANIMATIONS QUELLCODE */
} else
SendClientMessage(playerid, 0xFF6900AA, "Please stop the corrunt animation!");
}
public OnPlayerAnimationStopKeyPress(playerid) {
if(playerApplyAnim[playerid] == true) {
TextDrawHideForPlayer(playerid, applyTextDraw[playerid]);
TextDrawDestroy(applyTextDraw[playerid]);
/* ANIMATIONS STOP QUELLTEXT */
playerApplyAnim[playerid] = false;
}
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
if(newkeys == KEY_ACTION)
OnPlayerAnimationStopKeyPress(playerid);
}
public OnPlayerCommandText(playerid, cmdtext[]) {
if(!strcmp(cmdtext, "/animation1")) {
OnPlayerApplyAnimation(playerid);
return 1;
}
return 0;
} -
why strfind?
Oo strcmp macht mehr Sinn, weil strfind "GAMMEL" wäre auch richtig bei GAMMEL1.
z0mfg also wie wärs mit strcmp? :> -