Sprunk Automaten nochmal dringende Hilfe BITTE

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
  • Wenn du den MTA:SA Map Editor hast, dann mach einfach eine Map mit einem Sprunk Automaten und füg sie in den Server. Normal kannste dann daraus trinken.

  • hier hast du:

    Spoiler anzeigen

    #include <a_samp>
    #define MAX_SPRUNK 100 //Just change this if you are going ot use more than 100 sprunk machines
    #define SPRUNK_PRICE 1 //how much does a can of sprunk cost?
    forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z, Float:RotX, Float:RotY, Float:RotZ);
    forward Sprunkend(playerid);
    new sprunk[MAX_SPRUNK], Float:Rot[6][MAX_SPRUNK];

    Spoiler anzeigen
    public OnFilterScriptInit() {
    print("\n----------------------------------");
    print("CZ:RP Objekty a Towing by b00m");
    print("----------------------------------\n");
    }

    Spoiler anzeigen
    public OnFilterScriptExit() {
    print("\n----------------------------------");
    print("CZ:RP Objekty a Towing by b00m");
    print("----------------------------------\n");
    }

    Spoiler anzeigen
    public OnGameModeInit()
    {
    AddStaticSprunk(0,852.053,-1899.893,12.270,0,0,-90.000); // sprunt-piti
    return 1;
    }

    Spoiler anzeigen
    // TOWING by b00m
    public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
    // HIDEN CODE //

    for(new i = 0; i < MAX_SPRUNK; i++) // SPRUNK
    {
    if(PlayerToPoint(1.2,playerid,Rot[1][i],Rot[2][i],Rot[3][i],Rot[4][i],Rot[5][i],Rot[6][i])) // HERE IS PROBLEM NUMBER 1 (line 108)
    {
    if(newkeys == 16 && GetPlayerState(playerid == PLAYER_STATE_ONFOOT))
    {
    if(GetPlayerMoney(playerid) >= SPRUNK_PRICE)
    {
    SetPlayerPos(playerid,Rot[1][i]+0.2,Rot[2][i]-1,Rot[3][i]);

    TogglePlayerControllable(playerid,0);
    ApplyAnimation(playerid,"VENDING","VEND_Use",3.0,0,0,0,0,0); //sprunk machine animation
    PlayerPlaySound(playerid,42600,0,0,0); //sprunk machine noise - NOT SUPPORTED IN SA:MP
    SetTimerEx("Sprunkend",3000,0,"i",playerid);
    new cash = GetPlayerMoney(playerid);
    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid,cash-SPRUNK_PRICE);
    }
    else
    {
    PlayerPlaySound(playerid,1053,0,0,0); //rejected money sound - works!
    }
    }
    }
    }
    return true;
    }

    Spoiler anzeigen
    GetVehicleWithinDistance(playerid, Float:x1, Float:y1, Float:z1, Float:dist, &veh){
    for(new i = 1; i < MAX_VEHICLES; i++){
    if(GetVehicleModel(i) > 0){
    if(GetPlayerVehicleID(playerid) != i ){
    new Float:x, Float:y, Float:z;
    new Float:x2, Float:y2, Float:z2;
    GetVehiclePos(i, x, y, z);
    x2 = x1 - x; y2 = y1 - y; z2 = z1 - z;
    new Float:vDist = (x2*x2+y2*y2+z2*z2);
    if( vDist < dist){
    veh = i;
    }
    }
    }
    }
    }

    Spoiler anzeigen
    // SPRUNT MACHINE by GROVE

    Spoiler anzeigen
    stock AddStaticSprunk(id,Float:X,Float:Y,Float:Z,Float:RotX,Float:RotY,Float:RotZ)
    {
    sprunk[id] = CreateObject(955,X,Y,Z,RotX,RotY,RotZ);
    GetObjectPos(sprunk[id],Rot[1][id],Rot[2][id],Rot[3][id]);
    GetObjectRot(sprunk[id],Rot[4][id],Rot[5][id],Rot[6][id]); // HERE IS PROBLEM NUMBER TWO (line 157)
    return id;
    }

    Spoiler anzeigen
    public Sprunkend(playerid)
    {
    ApplyAnimation(playerid,"VENDING","VEND_Drink_P",3.0,0,0,0,0,0);
    TogglePlayerControllable(playerid,1);
    new Float:health;
    GetPlayerHealth(playerid,health);
    SetPlayerHealth(playerid,health+10);

    Spoiler anzeigen
    public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z, Float:RotX, Float:RotY, Float:RotZ)
    {
    new Float:oldposx, Float:oldposy, Float:oldposz, Float:oldposrotx, Float:oldposroty, Float:oldposrotz;
    new Float:tempposx, Float:tempposy, Float:tempposz, Float:tempposrotx, Float:tempposroty, Float:tempposrotz;
    GetPlayerPos(playerid, oldposx, oldposy, oldposz);
    GetObjectRot(playerid, oldposrotx, oldposroty, oldposrotz);
    tempposx = (oldposx -x);
    tempposy = (oldposy -y);
    tempposz = (oldposz -z);
    tempposrotx = (oldposrotx -RotX);
    tempposroty = (oldposroty -RotY);
    tempposrotz = (oldposrotz -RotZ);
    if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi) && (tempposrotx < radi) && (tempposrotx > -radi)) && ((tempposroty < radi) && (tempposroty > -radi)) && ((tempposrotz < radi) && (tempposrotz > -radi)))
    {
    return 1;
    }
    return 0;
    }

  • Kriege diese meldung


    Code
    C:\Dokumente und Einstellungen\----\Desktop\Server\-----\filterscripts\sprunk.pwn(33) : error 032: array index out of bounds (variable "Rot")
    C:\Dokumente und Einstellungen\-----\Desktop\Server\-----\filterscripts\sprunk.pwn(82) : error 032: array index out of bounds (variable "Rot")
    C:\Dokumente und Einstellungen\-----\Desktop\Server\-----\filterscripts\sprunk.pwn(115) : warning 203: symbol is never used: "GetVehicleWithinDistance"
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
    
    
    
    
    2 Errors.
  • Spoiler anzeigen

    #include <a_samp>
    #define MAX_SPRUNK 100 //Just change this if you are going ot use more than 100 sprunk machines
    #define SPRUNK_PRICE 1 //how much does a can of sprunk cost?
    forward Sprunkend(playerid);
    new sprunk[MAX_SPRUNK], Float:Rot[7][MAX_SPRUNK];

    Spoiler anzeigen
    public OnFilterScriptInit() {
    print("\n----------------------------------");
    print("CZ:RP Objekty a Towing by b00m");
    print("----------------------------------\n");
    }

    Spoiler anzeigen
    public OnFilterScriptExit() {
    print("\n----------------------------------");
    print("CZ:RP Objekty a Towing by b00m");
    print("----------------------------------\n");
    }

    Spoiler anzeigen
    public OnGameModeInit()
    {
    AddStaticSprunk(0,852.053,-1899.893,12.270,0,0,-90.000); // sprunt-piti
    return 1;
    }

    Spoiler anzeigen
    // TOWING by b00m
    public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
    // HIDEN CODE //

    Spoiler anzeigen
    for(new i = 0; i < MAX_SPRUNK; i++) // SPRUNK
    {
    if(IsPlayerInPointOfRange(playerid,1.2,Rot[1][i],Rot[2][i],Rot[3][i],Rot[4][i],Rot[5][i],Rot[6][i])) // HERE IS PROBLEM NUMBER 1 (line 108)
    {
    if(newkeys == 16 && GetPlayerState(playerid == PLAYER_STATE_ONFOOT))
    {
    if(GetPlayerMoney(playerid) >= SPRUNK_PRICE)
    {
    SetPlayerPos(playerid,Rot[1][i]+0.2,Rot[2][i]-1,Rot[3][i]);

    TogglePlayerControllable(playerid,0);
    ApplyAnimation(playerid,"VENDING","VEND_Use",3.0,0,0,0,0,0); //sprunk machine animation
    PlayerPlaySound(playerid,42600,0,0,0); //sprunk machine noise - NOT SUPPORTED IN SA:MP
    SetTimerEx("Sprunkend",3000,0,"i",playerid);
    new cash = GetPlayerMoney(playerid);
    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid,cash-SPRUNK_PRICE);
    }
    else
    {
    PlayerPlaySound(playerid,1053,0,0,0); //rejected money sound - works!
    }
    }
    }
    }
    return true;
    }

    Spoiler anzeigen
    // SPRUNT MACHINE by GROVE

    Spoiler anzeigen
    stock AddStaticSprunk(id,Float:X,Float:Y,Float:Z,Float:RotX,Float:RotY,Float:RotZ)
    {
    sprunk[id] = CreateObject(955,X,Y,Z,RotX,RotY,RotZ);
    GetObjectPos(sprunk[id],Rot[1][id],Rot[2][id],Rot[3][id]);
    GetObjectRot(sprunk[id],Rot[4][id],Rot[5][id],Rot[6][id]); // HERE IS PROBLEM NUMBER TWO (line 157)
    return id;
    }

    Spoiler anzeigen
    public Sprunkend(playerid)
    {
    ApplyAnimation(playerid,"VENDING","VEND_Drink_P",3.0,0,0,0,0,0);
    TogglePlayerControllable(playerid,1);
    new Float:health;
    GetPlayerHealth(playerid,health);
    SetPlayerHealth(playerid,health+10);
    return 1;
    }

    Spoiler anzeigen
    return 0;
    }


    errors müssten fixed sein ..
    0.3 Fixed. :)
    ungetestet.

  • Erstmal danke für eure ganzen Bemühungen,
    eber irgendwie will das bei mir nicht hinhauen:



    Hier mal meine .pwn: breadfish.de/wcf/attachment/1227/

  • Heißt soviel wie:
    IsPlayerInPointOfRange gibt es nicht, oder ist falsch eingegeben.

  • :D Ja ich habe die Native Falsch geschrieben ^^ sry


    Fixed :

    Spoiler anzeigen

    #include <a_samp>
    #define MAX_SPRUNK 100 //Just change this if you are going ot use more than 100 sprunk machines
    #define SPRUNK_PRICE 1 //how much does a can of sprunk cost?
    forward Sprunkend(playerid);
    new sprunk[MAX_SPRUNK], Float:Rot[7][MAX_SPRUNK];

    Spoiler anzeigen
    public OnFilterScriptInit() {
    print("\n----------------------------------");
    print("CZ:RP Objekty a Towing by b00m");
    print("----------------------------------\n");
    }

    Spoiler anzeigen
    public OnFilterScriptExit() {
    print("\n----------------------------------");
    print("CZ:RP Objekty a Towing by b00m");
    print("----------------------------------\n");
    }

    Spoiler anzeigen
    public OnGameModeInit()
    {
    AddStaticSprunk(0,852.053,-1899.893,12.270,0,0,-90.000); // sprunt-piti
    return 1;
    }

    Spoiler anzeigen
    // TOWING by b00m
    public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
    // HIDEN CODE //
    for(new i = 0; i < MAX_SPRUNK; i++) // SPRUNK
    {
    if(IsPlayerInRangeOfPoint(playerid,1.2,Rot[1],Rot[2],Rot[3])) // ,Rot[4],Rot[5],Rot[6]
    {
    if(newkeys == 16 && GetPlayerState(playerid == PLAYER_STATE_ONFOOT))
    {
    if(GetPlayerMoney(playerid) >= SPRUNK_PRICE)
    {
    SetPlayerPos(playerid,Rot[1]+0.2,Rot[2]-1,Rot[3]);
    TogglePlayerControllable(playerid,0);
    ApplyAnimation(playerid,"VENDING","VEND_Use",3.0,0,0,0,0,0); //sprunk machine animation
    PlayerPlaySound(playerid,42600,0,0,0); //sprunk machine noise - NOT SUPPORTED IN SA:MP
    SetTimerEx("Sprunkend",3000,0,"i",playerid);
    new cash = GetPlayerMoney(playerid);
    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid,cash-SPRUNK_PRICE);
    }
    else
    {
    PlayerPlaySound(playerid,1053,0,0,0); //rejected money sound - works!
    }
    }
    }
    }
    return true;
    }

    Spoiler anzeigen
    // SPRUNT MACHINE by GROVE

    Spoiler anzeigen
    stock AddStaticSprunk(id,Float:X,Float:Y,Float:Z,Float:RotX,Float:RotY,Float:RotZ)
    {
    sprunk[id] = CreateObject(955,X,Y,Z,RotX,RotY,RotZ);
    GetObjectPos(sprunk[id],Rot[1][id],Rot[2][id],Rot[3][id]);
    GetObjectRot(sprunk[id],Rot[4][id],Rot[5][id],Rot[6][id]); // HERE IS PROBLEM NUMBER TWO (line 157)
    return id;
    }

    Spoiler anzeigen
    public Sprunkend(playerid)
    {
    ApplyAnimation(playerid,"VENDING","VEND_Drink_P",3.0,0,0,0,0,0);
    TogglePlayerControllable(playerid,1);
    new Float:health;
    GetPlayerHealth(playerid,health);
    SetPlayerHealth(playerid,health+10);
    return 1;
    }[i][i][i][i]


    Ps. Ich glaube das WB hat irgendwie Probleme (Mal wieder ) 8|


    LG[/i][/i][/i][/i]


    Einmal editiert, zuletzt von Guest- ()

  • if(IsPlayerInRangeOfPoint(playerid,1.2,Rot[1],Rot[2],Rot[3])) // ,Rot[4],Rot[5],Rot[6][i][/i]

    [i][i][i]
    Es werden weniger fehler:


    [/i][/i][/i]

    Code
    C:\DOKUME~1\-----\Desktop\Server\-----\FILTER~1\sprunk.pwn(31) : error 035: argument type mismatch (argument 3)
    Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase
    
    
    
    
    1 Error.


    wieso will das denn nicht :(
    [i][/i][i][i][i][i][i][i][/i][/i][/i][/i][/i][/i]

  • ?( wie das mit dem i odr so entsteht ist mir unklar aber jetzt zum Thema zurück


    also:


    Code
    Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


    Und der Sprunk Automat wird gespawnt doch ich kann ihn nicht benutzen???