Derby? nur bei id 0 ?!

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
  • tach, also ich hab mir letztens ein derby systehm gebaut. Nun ist das Problem das dieses Systhem nur bei playerid 0 funktionier könnt ihr mir helfen?
    #include <a_samp>
    #include <MidoStream>


    #define COLOR_GRAD1 0xB4B5B7FF
    #define COLOR_GRAD2 0xBFC0C2FF
    #define COLOR_GRAD3 0xCBCCCEFF
    #define COLOR_GRAD4 0xD8D8D8FF
    #define COLOR_GRAD5 0xE3E3E3FF
    #define COLOR_GRAD6 0xF0F0F0FF
    #define COLOR_GREY 0xAFAFAFAA
    #define COLOR_GREEN 0x33AA33AA
    #define COLOR_RED 0xAA3333AA
    #define COLOR_LIGHTRED 0xFF6347AA
    #define COLOR_LIGHTBLUE 0x33CCFFAA
    #define COLOR_LIGHTGREEN 0x9ACD32AA
    #define COLOR_YELLOW 0xFFFF00AA
    #define COLOR_YELLOW2 0xF5DEB3AA
    #define COLOR_WHITE 0xFFFFFFAA
    #define COLOR_FADE1 0xE6E6E6E6
    #define COLOR_FADE2 0xC8C8C8C8
    #define COLOR_FADE3 0xAAAAAAAA
    #define COLOR_FADE4 0x8C8C8C8C
    #define COLOR_FADE5 0x6E6E6E6E
    #define COLOR_PURPLE 0xC2A2DAAA
    #define COLOR_DBLUE 0x2641FEAA
    #define COLOR_ALLDEPT 0xFF8282AA
    #define COLOR_NEWS 0xFFA500AA
    #define COLOR_OOC 0xE0FFFFAA


    #define OBJECTIVE_COLOR 0x64000064
    #define TEAM_GREEN_COLOR 0xFFFFFFAA
    #define TEAM_JOB_COLOR 0xFFB6C1AA
    #define TEAM_HIT_COLOR 0xFFFFFF00
    #define TEAM_BLUE_COLOR 0x8D8DFF00
    #define COLOR_ADD 0x63FF60AA
    #define TEAM_GROVE_COLOR 0x00D900C8
    #define TEAM_VAGOS_COLOR 0xFFC801C8
    #define TEAM_BALLAS_COLOR 0xD900D3C8
    #define TEAM_AZTECAS_COLOR 0x01FCFFC8
    #define TEAM_CYAN_COLOR 0xFF8282AA
    #define TEAM_ORANGE_COLOR 0xFF830000
    #define TEAM_COR_COLOR 0x39393900
    #define TEAM_BAR_COLOR 0x00D90000
    #define TEAM_TAT_COLOR 0xBDCB9200
    #define TEAM_CUN_COLOR 0xD900D300
    #define TEAM_STR_COLOR 0x01FCFF00
    #define TEAM_ADMIN_COLOR 0x00808000
    #define COLOR_INVIS 0xAFAFAF00
    #define COLOR_SPEC 0xBFC0C200


    #define Derby_World 3
    #define Max_Players 3


    #define DerbySpawn1 1554.1332,-1245.8550,277.8818
    #define DerbySpawn2 1553.6554,-1226.5444,277.8819
    #define DerbySpawn3 1592.6656,-1244.3057,277.8774


    #define RausGeflogen 2495.0935,-1686.8622,13.5141
    #define CameraPos 1222.9048,-887.4230,42.8945
    #define CameraLookAt 1226.5520,-880.8740,43.0938




    new InDerby;
    new Derby[MAX_PLAYERS];
    new DerbyID[MAX_PLAYERS];
    new ID1;
    new ID2;
    new ID3;



    new lTeam[MAX_PLAYERS];
    #define derbyin 0
    #define derbyout 1
    #define derbyno 2



    forward Timer1(playerid);
    forward Timer2(playerid);
    forward message(playerid);


    #if defined FILTERSCRIPT



    public OnFilterScriptInit()
    {
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
    }


    public OnFilterScriptExit()
    {
    return 1;
    }


    #else


    main()
    {
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
    }


    #endif


    public OnGameModeInit()
    {
    //SetGameModeText("Blank Script");
    //AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
    }


    public OnGameModeExit()
    {
    return 1;
    }


    public OnPlayerRequestClass(playerid, classid)
    {
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
    }


    public OnPlayerConnect(playerid)
    {
    return 1;
    }


    public OnPlayerDisconnect(playerid, reason)
    {
    if(Derby[playerid] == 1)
    { Derby[playerid] = 0; InDerby = InDerby - 1; }
    return 1;
    }


    public OnPlayerSpawn(playerid)
    {
    if (Derby[playerid] == 1)
    {
    SetPlayerVirtualWorld(playerid,3);
    if (DerbyID[playerid] == 1)
    {
    new car;
    SetPlayerPos(playerid,DerbySpawn1);
    new Float:rot;
    car = CreateVehicle(451,1554.1332,-1245.8550,277.8818,rot,1,3,0);
    SetVehicleVirtualWorld(car,3);
    {
    PutPlayerInVehicle(playerid,car,0);
    }
    }

    else if (DerbyID[playerid] == 2)
    {
    new car;
    SetPlayerPos(playerid,DerbySpawn2);
    new Float:rot;
    car = CreateVehicle(451,1553.6554,-1226.5444,277.8819,rot,1,3,0);
    SetVehicleVirtualWorld(car,3);
    {
    PutPlayerInVehicle(playerid,car,0);
    }
    }

    else if (DerbyID[playerid] == 3)
    {
    new car;
    SetPlayerPos(playerid,DerbySpawn1);
    new Float:rot;
    car = CreateVehicle(451,1592.6656,-1244.3057,277.8774,rot,1,3,0);
    SetVehicleVirtualWorld(car,3);
    {
    PutPlayerInVehicle(playerid,car,0);
    }
    }

    SetTimer("Timer1",1000,1);
    }
    else
    {
    //do nichts
    }
    return 1;
    }


    public OnPlayerDeath(playerid, killerid, reason)
    {
    return 1;
    }


    public OnVehicleSpawn(vehicleid)
    {
    return 1;
    }


    public OnVehicleDeath(vehicleid, killerid)
    {
    return 1;
    }


    public OnPlayerText(playerid, text[])
    {
    return 1;
    }


    public OnPlayerCommandText(playerid, cmdtext[])
    {
    if (strcmp("/derby", cmdtext, true, 10) == 0)
    {
    if (InDerby == 3)
    {
    SendClientMessage(playerid,COLOR_LIGHTRED,"Derby ist voll ! ");
    }
    else
    {
    Derby[playerid] = 1;
    InDerby = InDerby + 1;
    lTeam[playerid] = derbyin;
    SetPlayerVirtualWorld(playerid,3);

    if (ID1 == 0)
    {
    ID1 = 1;
    DerbyID[playerid] = 1;
    lTeam[playerid] = derbyin;
    }

    else if(ID2 == 0)
    {
    ID2 = 1;
    DerbyID[playerid] = 1;
    lTeam[playerid] = derbyin;
    }

    else if(ID3 == 0)
    {
    ID3 = 1;
    DerbyID[playerid] = 1;
    lTeam[playerid] = derbyin;
    }
    SpawnPlayer(playerid);
    }
    return 1;
    }

    if (strcmp("/derbyexit", cmdtext, true, 10) == 0)
    {
    if (Derby[playerid] == 1)
    {
    Derby[playerid] = 0;
    InDerby = InDerby - 1;
    lTeam[playerid] = derbyno;
    SetPlayerVirtualWorld(playerid,0);
    SendClientMessage(playerid,COLOR_LIGHTGREEN,"Derby Left");
    }
    else
    {
    SendClientMessage(playerid,COLOR_LIGHTGREEN,"You are not in derby!");
    }
    }

    return 0;
    }


    public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
    {
    return 1;
    }


    public OnPlayerExitVehicle(playerid, vehicleid)
    {
    return 1;
    }


    public OnPlayerStateChange(playerid, newstate, oldstate)
    {
    return 1;
    }


    public OnPlayerEnterCheckpoint(playerid)
    {
    return 1;
    }


    public OnPlayerLeaveCheckpoint(playerid)
    {
    return 1;
    }


    public OnPlayerEnterRaceCheckpoint(playerid)
    {
    return 1;
    }


    public OnPlayerLeaveRaceCheckpoint(playerid)
    {
    return 1;
    }


    public OnRconCommand(cmd[])
    {
    return 1;
    }


    public OnPlayerRequestSpawn(playerid)
    {
    return 1;
    }


    public OnObjectMoved(objectid)
    {
    return 1;
    }


    public OnPlayerObjectMoved(playerid, objectid)
    {
    return 1;
    }


    public OnPlayerPickUpPickup(playerid, pickupid)
    {
    return 1;
    }


    public OnVehicleMod(playerid, vehicleid, componentid)
    {
    return 1;
    }


    public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
    {
    return 1;
    }


    public OnVehicleRespray(playerid, vehicleid, color1, color2)
    {
    return 1;
    }


    public OnPlayerSelectedMenuRow(playerid, row)
    {
    return 1;
    }


    public OnPlayerExitedMenu(playerid)
    {
    return 1;
    }


    public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
    {
    return 1;
    }


    public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
    return 1;
    }


    public OnRconLoginAttempt(ip[], password[], success)
    {
    return 1;
    }


    public OnPlayerUpdate(playerid)
    {
    return 1;
    }


    public OnPlayerStreamIn(playerid, forplayerid)
    {
    return 1;
    }


    public OnPlayerStreamOut(playerid, forplayerid)
    {
    return 1;
    }


    public OnVehicleStreamIn(vehicleid, forplayerid)
    {
    return 1;
    }


    public OnVehicleStreamOut(vehicleid, forplayerid)
    {
    return 1;
    }


    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    return 1;
    }


    public OnPlayerClickPlayer(playerid, clickedplayerid, source)
    {
    return 1;
    }


    public Timer1(playerid)
    {


    new Float: x, Float: y, Float: z, string[127], pname[MAX_PLAYER_NAME];
    new Float:health;
    new qehicleid = GetPlayerVehicleID(playerid);
    GetVehicleHealth(qehicleid, health);

    if (GetPlayerPos(playerid,x,y,z)== x,y,z < 271.5938)
    {
    TogglePlayerControllable(playerid, false);
    SetTimer("Timer2",9000,0);
    DestroyVehicle(qehicleid);

    if (lTeam[playerid] == derbyout)
    {
    return 0;
    }
    else if (lTeam[playerid] == derbyin)
    {
    SetPlayerPos(playerid,RausGeflogen);
    {
    lTeam[playerid] = derbyout;
    GetPlayerName(playerid,pname,sizeof(pname));
    format(string,sizeof(string),"%s ist aus dem Derby geflogen in 9 Sekunden Spielt er wieder mit",pname);
    SendClientMessageToAll(COLOR_LIGHTGREEN,string);
    SetPlayerPos(playerid, 1607.6656,-1244.3016,287.6066);
    SetPlayerCameraPos(playerid, 1607.6656,-1244.3016,287.6066);
    SetPlayerCameraLookAt(playerid, 1571.4849,-1241.3915,277.8767);
    }
    return 0;
    }
    }


    else if (health < 200)
    {
    TogglePlayerControllable(playerid, false);
    SetTimer("Timer2",9000,0);
    DestroyVehicle(qehicleid);


    if (lTeam[playerid] == derbyout)
    {
    return 0;
    }
    else if (lTeam[playerid] == derbyin)
    {
    SetPlayerPos(playerid,RausGeflogen);
    {
    lTeam[playerid] = derbyout;
    GetPlayerName(playerid,pname,sizeof(pname));
    format(string,sizeof(string),"%s ist aus dem Derby geflogen in 9 Sekunden Spielt er wieder mit",pname);
    SendClientMessageToAll(COLOR_LIGHTGREEN,string);
    SetPlayerPos(playerid, 1607.6656,-1244.3016,287.6066);
    SetPlayerCameraPos(playerid, 1607.6656,-1244.3016,287.6066);
    SetPlayerCameraLookAt(playerid, 1571.4849,-1241.3915,277.8767);
    }
    return 0;
    }
    }



    return 1;
    }


    public Timer2(playerid)
    {


    new string[127];
    new pname[MAX_PLAYER_NAME];

    if (lTeam[playerid] == derbyout)
    {
    SetPlayerPos(playerid,DerbySpawn1);
    {
    lTeam[playerid] = derbyin;
    SetCameraBehindPlayer(playerid);
    GetPlayerName(playerid,pname,sizeof(pname));
    format(string,sizeof(string),"%s ist nun wieder im Derby",pname);
    SendClientMessageToAll(COLOR_LIGHTRED,string);
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist nun wieder im Spiel!");
    TogglePlayerControllable(playerid, true);



    new car;
    new Float:rot;
    car = CreateVehicle(451,1592.6656,-1244.3057,277.8774,rot,1,3,0);
    SetVehicleVirtualWorld(car,3);
    {
    PutPlayerInVehicle(playerid,car,0);
    }
    }
    return 0;
    }
    else if (lTeam[playerid] == derbyin)
    {

    return 0;
    }


    return 1;
    }



  • also mit dem widerholen funktioniert es ja aber das mit dem settimerEx geht es nicht:
    Ps: i hab ich als
    for(new i=0;i<MAX_PLAYERS;i++) 
    definiert hoffe das is richtig und bei SetTimerEx komm immer nen error:

    Code
    E:\NFW\gamemodes\dtest.pwn(186) : error 035: argument type mismatch (argument 4)
    Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase
    
    
    
    
    1 Error.
  • do.de - Domain-Offensive - Domains für alle und zu super Preisen
  • So ist es richtig:


    Zitat

    SetTimerEx("Timer1",1000,1,"d",i);

  • werd aerstmal testen danke :rolleyes:


    Edit: :?: So, hab es jz gemacht nun das Problem das Sobald einer ins derby geht sofort tausend autos entstehen und man immer wider raus geschmißen wird.
    public Timer1(playerid)
    {
    for(new i=0;i<MAX_PLAYERS;i++)
    {
    new Float: x, Float: y, Float: z, string[127], pname[MAX_PLAYER_NAME];
    new Float:health;
    new qehicleid = GetPlayerVehicleID(playerid);
    GetVehicleHealth(qehicleid, health);

    if (GetPlayerPos(playerid,x,y,z)== x,y,z < 271.5938)
    {
    TogglePlayerControllable(playerid, false);
    SetTimer("Timer2",9000,0);
    DestroyVehicle(qehicleid);

    if (lTeam[playerid] == derbyout)
    {
    return 0;
    }
    else if (lTeam[playerid] == derbyin)
    {
    SetPlayerPos(playerid,RausGeflogen);
    {
    lTeam[playerid] = derbyout;
    GetPlayerName(playerid,pname,sizeof(pname));
    format(string,sizeof(string),"%s ist aus dem Derby geflogen in 9 Sekunden Spielt er wieder mit",pname);
    SendClientMessageToAll(COLOR_LIGHTGREEN,string);
    SetPlayerPos(playerid, 1607.6656,-1244.3016,287.6066);
    SetPlayerCameraPos(playerid, 1607.6656,-1244.3016,287.6066);
    SetPlayerCameraLookAt(playerid, 1571.4849,-1241.3915,277.8767);
    }
    return 0;
    }
    }


    else if (health < 200)
    {
    TogglePlayerControllable(playerid, false);
    SetTimerEx("Timer2",9000,1,"d",i);
    DestroyVehicle(qehicleid);


    if (lTeam[playerid] == derbyout)
    {
    return 0;
    }
    else if (lTeam[playerid] == derbyin)
    {
    SetPlayerPos(playerid,RausGeflogen);
    {
    lTeam[playerid] = derbyout;
    GetPlayerName(playerid,pname,sizeof(pname));
    format(string,sizeof(string),"%s ist aus dem Derby geflogen in 9 Sekunden Spielt er wieder mit",pname);
    SendClientMessageToAll(COLOR_LIGHTGREEN,string);
    SetPlayerPos(playerid, 1607.6656,-1244.3016,287.6066);
    SetPlayerCameraPos(playerid, 1607.6656,-1244.3016,287.6066);
    SetPlayerCameraLookAt(playerid, 1571.4849,-1241.3915,277.8767);
    }
    return 0;
    }
    }



    }
    return 1;
    }


    public Timer2(playerid)
    {


    new string[127];
    new pname[MAX_PLAYER_NAME];

    if (lTeam[playerid] == derbyout)
    {
    SetPlayerPos(playerid,DerbySpawn1);
    {
    lTeam[playerid] = derbyin;
    SetCameraBehindPlayer(playerid);
    GetPlayerName(playerid,pname,sizeof(pname));
    format(string,sizeof(string),"%s ist nun wieder im Derby",pname);
    SendClientMessageToAll(COLOR_LIGHTRED,string);
    SendClientMessage(playerid,COLOR_LIGHTRED,"Du bist nun wieder im Spiel!");
    TogglePlayerControllable(playerid, true);



    new car;
    new Float:rot;
    car = CreateVehicle(451,1592.6656,-1244.3057,277.8774,rot,1,3,0);
    SetVehicleVirtualWorld(car,3);
    {
    PutPlayerInVehicle(playerid,car,0);
    }
    }
    return 0;
    }
    else if (lTeam[playerid] == derbyin)
    {

    return 0;
    }


    return 1;
    }


    2 Mal editiert, zuletzt von [NFW]Ruffo ()