Szerző Téma: Minigame HELP!!!  (Megtekintve 669 alkalommal)

Minigame HELP!!!
« Dátum: 2013. február 10. - 13:38:00 »
0 Show voters
Van nekem egy minigáme scriptem de nem és én átalakitotam de valamiért nem megy tökéletesen az akir beirja a /minigame parancsot azt beteszi a minigámeba de ha csatlakozni akar valaki a minigámebe akor azt vagy nem teszi be vagy be teszi de nem a pájára hanem a pája allá dobja vagyi bebugol ha 2 játékos akor csatlakozni a játékhoz
 
#include <a_samp>
#include <foreach>
#include <fixchars>
#pragma tabsize 0
new SUMO[MAX_PLAYERS];
new SUMOCAR2[MAX_PLAYERS];
new SumoStarted;
new SumoSpawn;
new Roman[MAX_PLAYERS];
new SumoCar[MAX_PLAYERS];
new SumoTimer;
new SumoSec;
new SumoPlayers;
new InSumo[MAX_PLAYERS];
new Float:SumoSpawn2 [][4] =
{
{5016.9028,-1818.4657,5.7785,178.5417},
{5016.6494,-1817.9543,5.7785,179.8417},
{5094.6938,-1818.4242,5.6285,178.5884},
{5093.2153,-1851.8483,5.6285,88.6609},
{5055.3389,-1887.9875,5.3785,359.0468}
};
static minid[MAX_PLAYERS]={ -1, ... };
#define ScoreWin 0
#define CashWin 50000
#define red 0xFF0000AA
public OnPlayerConnect(playerid)
{
    InSumo[playerid] =0;
    SUMO[playerid]=0;
    minid[playerid] = -1;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    SUMO[playerid]=0;
    if(InSumo[playerid] == 1)
    {
    DestroyVehicle(SumoCar[playerid]);
    SumoPlayers--;
InSumo[playerid] = 0;
    new string[1900];
    if(Roman[playerid] == 0)
    if(SumoPlayers == 1)
    {
    for(new i = 0; i < GetMaxPlayers(); i++)
    {
    if(InSumo == 1)
    {
    if(Roman[playerid] == 0)
    SendClientMessageToAll(red,string);
    SetPlayerScore(i,GetPlayerScore(i)+ScoreWin);
    GivePlayerMoney(i,CashWin);
    SumoPlayers--;
    InSumo[playerid] = 0;
    SUMO[playerid]=0;
    SumoPlayers = 0;
    SumoStarted = 0;
    DestroyVehicle(SumoCar);
    SetTimerEx(\"SpawnPP\",1000,0,\"i\",i);
    InSumo = 0;
    minid[playerid] = -1;
}
    }
    }
    }
    return 1;
}
forward SumoRandomCar(playerid);
public SumoRandomCar(playerid)
{
    new pRandom = random(sizeof(SumoSpawn2));
    new vRandom = random(5);
    switch (vRandom)
    {
                case 0:
                {
      DestroyVehicle(SUMOCAR2[playerid]);
                SUMOCAR2[playerid] = SetVehicleVirtualWorld( CreateVehicle(504,SumoSpawn2[pRandom][0], SumoSpawn2[pRandom][1], SumoSpawn2[pRandom][2], SumoSpawn2[pRandom][3],-1,-1,9999999),5);}
      case 1:
                {
                DestroyVehicle(SUMOCAR2[playerid]);
      SUMOCAR2[playerid] = SetVehicleVirtualWorld( CreateVehicle(504,SumoSpawn2[pRandom][0], SumoSpawn2[pRandom][1], SumoSpawn2[pRandom][2], SumoSpawn2[pRandom][3],-1,-1,9999999),5);}
                case 2:
                {
                DestroyVehicle(SUMOCAR2[playerid]);
      SUMOCAR2[playerid] = SetVehicleVirtualWorld( CreateVehicle(504,SumoSpawn2[pRandom][0], SumoSpawn2[pRandom][1], SumoSpawn2[pRandom][2], SumoSpawn2[pRandom][3],-1,-1,9999999),5);}
                case 3:
                {
                DestroyVehicle(SUMOCAR2[playerid]);
      SUMOCAR2[playerid] = SetVehicleVirtualWorld( CreateVehicle(504,SumoSpawn2[pRandom][0], SumoSpawn2[pRandom][1], SumoSpawn2[pRandom][2], SumoSpawn2[pRandom][3],-1,-1,9999999),5);}
                case 4:
                {
                DestroyVehicle(SUMOCAR2[playerid]);
      SUMOCAR2[playerid] = SetVehicleVirtualWorld( CreateVehicle(504,SumoSpawn2[pRandom][0], SumoSpawn2[pRandom][1], SumoSpawn2[pRandom][2], SumoSpawn2[pRandom][3],-1,-1,9999999),5);}
    }
    return SUMOCAR2[playerid];
}
public OnPlayerUpdate(playerid)
{
    if(InSumo[playerid]==1)
    {
    new Float:x,Float:y,Float:z;
    if(GetPlayerPos(playerid,x,y,z) && z < -1.0)
    {
    RemovePlayerFromVehicle(playerid);
    SUMO[playerid]=0;
    if(InSumo[playerid] == 1)
    {
    DestroyVehicle(SumoCar[playerid]);
    SumoPlayers--;
    InSumo[playerid] = 0;
    new string[128];
    if(Roman[playerid] == 0)
    if(SumoPlayers == 1)
    {
    for(new i = 0; i < GetMaxPlayers(); i++)
    {
    if(InSumo == 1)
    {
    if(Roman[playerid] == 0)
    {
    format(string, sizeof(string), \"%s Megnyerte a minigamet\", Name(i),ScoreWin,CashWin);
    SetPlayerPos(playerid,-1372.7501,-263.4500,14.1484);
}
    SendClientMessageToAll(red,string);
    SetPlayerScore(i,GetPlayerScore(i)+ScoreWin);
    GivePlayerMoney(i,CashWin);
    SumoPlayers = 0;
    SumoStarted = 0;
    DestroyVehicle(SumoCar);
    SetTimerEx(\"SpawnPP\",1000,0,\"i\",i);
    InSumo = 0;
    SetPlayerVirtualWorld(playerid,0);
minid[playerid] = -1;
}
    }
    }
    }
    return 1;
    }
    }
    return true;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(\"/minigame\", cmdtext, true, 10) == 0)
{
if(InSumo[playerid] == 0)
                {
                if(SumoStarted == 0)
                {
                if(Roman[playerid] == 0)
                {
                SendClientMessageToAll(0xFFFF00AA,\"Minigame játék elindult! Csatlakozásért használad {ff0000}/minigame!\");
                }
                minid[playerid] = 0;
      SetPlayerVirtualWorld(playerid,5);
      SumoStarted=1;
                InSumo[playerid] = 1;
                SumoSpawn=2;
                SumoTimer = SetTimer(\"StartSumo\",600,1);
                SumoSec = 30;
                TogglePlayerControllable(playerid,0);
                PutPlayerInVehicle(playerid,SumoRandomCar(playerid),0);
                SumoPlayers = 1;
                }else
                if(SumoStarted == 1)
                {
                SumoPlayers++;
                if(SumoSpawn == 2)
                {
                SumoSpawn=3;
                PutPlayerInVehicle(playerid,SumoRandomCar(playerid),0);
                InSumo[playerid] = 1;
                TogglePlayerControllable(playerid,0);
                }else
                if(SumoSpawn == 3)
                {
                SumoSpawn=4;
                PutPlayerInVehicle(playerid,SumoRandomCar(playerid),0);
                InSumo[playerid] = 1;
                TogglePlayerControllable(playerid,0);
                }else
                if(SumoSpawn == 4)
                {
                SumoSpawn=5;
                PutPlayerInVehicle(playerid,SumoRandomCar(playerid),0);
                InSumo[playerid] = 1;
                TogglePlayerControllable(playerid,0);
                }else
                if(SumoSpawn == 5)
                {
                SumoSpawn=6;
                PutPlayerInVehicle(playerid,SumoRandomCar(playerid),0);
                InSumo[playerid] = 1;
                TogglePlayerControllable(playerid,0);
                }else
                if(SumoSpawn == 6)
                {
                SumoSpawn=7;
                PutPlayerInVehicle(playerid,SumoRandomCar(playerid),0);
                InSumo[playerid] = 1;
                TogglePlayerControllable(playerid,0);
                }else
                if(SumoSpawn == 7)
                {
                SumoSpawn=8;
                PutPlayerInVehicle(playerid,SumoRandomCar(playerid),0);
                InSumo[playerid] = 1;
                TogglePlayerControllable(playerid,0);
                }else
                if(SumoSpawn == 8)
                {
                SumoSpawn=9;
                PutPlayerInVehicle(playerid,SumoRandomCar(playerid),0);
                InSumo[playerid] = 1;
                TogglePlayerControllable(playerid,0);
                }else
                if(SumoSpawn == 9)
                {
                SumoSpawn=10;
                KillTimer(SumoTimer);
                PutPlayerInVehicle(playerid,SumoRandomCar(playerid),0);
                InSumo[playerid] = 1;
                SumoStarted = 2;
                SendClientMessageToAll(0xAA3333AA,\"{cccccc}Kiestél a játéból! {3399ff}Car Sumo Minigame {cccccc}elíndult!\");
                for(new i = 0; i < GetMaxPlayers(); i++)
            {
            if(InSumo == 1)
            {
                           TogglePlayerControllable(i,1);
                           GameTextForPlayer(i,\"~r~~h~Kiestél!\",3000,3);
                           SetTimerEx(\"Eliminat\",500,0,\"i\",i);
                return 1;
            }
            return 1;
        }
        }
        }else SendClientMessage(playerid,0xFF0000AA,\"A Minigame már elindult!\");
        }else SendClientMessage(playerid,0xFF0000AA,\"Már benne vagy a Minigameban kilépéshez /exitminigame!\");
return 1;
}
if (strcmp(\"/exitminigame\", cmdtext, true, 10) == 0)
{
if(minid[playerid] == -1) return SendClientMessage(playerid,0xFFFF00AA,\"Nem vagy Minigámeban!\");
        minid[playerid] = -1;
        SetPlayerVirtualWorld(playerid,0);
for(new i = 0; i < GetMaxPlayers(); i++)
        {
        if(InSumo == 1)
        {
new Float:x,Float:y,Float:z;
        GetPlayerPos(i,x,y,z);
        SetPlayerPos(i,x,y,z+1);
        DestroyVehicle(SumoCar);
        SetTimerEx(\"SpawnPP\",1000,0,\"i\",i);
        KillTimer(SumoTimer);
        InSumo =0;
        TogglePlayerControllable(i,1);
        }
        }
        SumoStarted=0;
SpawnPlayer(playerid);
return SendClientMessage(playerid,0xFFFF00AA,\"Kiléptél a Minigámebõl.\");
        }else if(minid[playerid] != -1) return SendClientMessage(playerid,0xFF0000AA,\"Minigámeben nem használhatsz parancsokat Kilépéshez: /exitminigame\");
    return 0;
}
public OnPlayerDeath(playerid, killerid, reason)
{
    if(InSumo[playerid] == 1)
    {
    DestroyVehicle(SumoCar[playerid]);
    SumoPlayers--;
    InSumo[playerid] = 0;
    new string [1900];
    if(Roman[playerid] == 0)
    if(SumoPlayers == 1)
    {
    for(new i = 0; i < GetMaxPlayers(); i++)
    {
    if(InSumo == 1)
    {
    if(Roman[playerid] == 0)
    {
    format(string, sizeof(string), \"%s Megnyerte a minigamet\", Name(i),ScoreWin,CashWin);
    SetPlayerPos(playerid,-1372.7501,-263.4500,14.1484);
    }
    SendClientMessageToAll(red,string);
    SetPlayerScore(i,GetPlayerScore(i)+ScoreWin);
    GivePlayerMoney(i,CashWin);
    SumoPlayers = 0;
    InSumo[playerid] = 0;
    SumoStarted = 0;
    new Float:x,Float:y,Float:z;
    GetPlayerPos(i,x,y,z);
    SetPlayerPos(i,x,y,z+1);
    DestroyVehicle(SumoCar);
    SetTimerEx(\"SpawnPP\",1000,0,\"i\",i);
    TogglePlayerControllable(i,1);
    SetPlayerVirtualWorld(playerid,0);
minid[playerid] = -1;
InSumo = 0;
    }
    }
    }
    }
    return 1;
}
public OnPlayerSpawn(playerid)
{
    switch(minid[playerid])
    {
         case 0: // 0-ás azonosítószámú dm zónához tartozó tevékenységek
         {
         InSumo[playerid] =0;
         if(SUMO[playerid]==1)
         {
         PutPlayerInVehicle(playerid,SumoRandomCar(playerid),0);
         }
         return 1;
}
    }
    return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(InSumo[playerid] == 1)
    {
        PutPlayerInVehicle(playerid,SumoCar[playerid],0);
    }
    return 1;
}
forward StartSumo(playerid);
public StartSumo(playerid)
{
        if(SumoSec > 1)
        {
                new time;
                new strec[128];
                SumoSec--;
                time = (SumoSec);
                format(strec, sizeof(strec), \"~h~~r~Minigame Kezdés %d\", time);
                for(new i = 0; i < GetMaxPlayers(); i++)
        {
        if(InSumo == 1)
        {
                GameTextForPlayer(i, strec, 3000, 3);
                }
                }
        }
        if(SumoSec == 1)
        {
                SumoSec = 0;
                if(SumoPlayers >= 2)
                {
                for(new i = 0; i < GetMaxPlayers(); i++)
        {
        if(InSumo == 1)
        {
                GameTextForPlayer(i, \"~h~~w~- START -\", 3000, 3);
                KillTimer(SumoTimer);
                TogglePlayerControllable(i,1);
 
                SumoStarted=2;
                SetTimerEx(\"Eliminat\",500,0,\"i\",i);
                }
                }
                }else
                if(SumoPlayers < 2)
                {
        for(new i = 0; i < GetMaxPlayers(); i++)
        {
        if(InSumo == 1)
        {
        new Float:x,Float:y,Float:z;
        GetPlayerPos(i,x,y,z);
        SetPlayerPos(i,x,y,z+1);
        DestroyVehicle(SumoCar);
        SetTimerEx(\"SpawnPP\",1000,0,\"i\",i);
                KillTimer(SumoTimer);
                InSumo =0;
                TogglePlayerControllable(i,1);
                }
                }
                SumoStarted=0;
                SetPlayerVirtualWorld(playerid,0);
      minid[playerid] = -1;
      if(Roman[playerid] == 0)
                {
                SendClientMessage(playerid,0xFF0000AA,\"A Derby Minigame befejezdõdõtt! Indok: Legalább 2 játékos szûkséges!\");
                SetPlayerPos(playerid,-1372.7501,-263.4500,14.1484);
                }
                }
                }
                return 1;
}
stock Name(playerid)
{
        new name[24];
        GetPlayerName(playerid,name,24);
        return name;
}

Nem elérhető Cappsy

  • Adminisztrátor
  • 2754
    • Profil megtekintése
Minigame HELP!!!
« Válasz #1 Dátum: 2013. február 10. - 13:41:17 »
0 Show voters
:sick: :sick: :sick: :sick: :sick:
Figyelj mire ezt valaki elolvassa addigra leszédül a székrõl...
Lehet nem agyar vagy ez nem is baj de már csak a magad kedvéért van online helyesírás elemzõ...
Igaziból én a problémádat se nagyon értem szóval

Minigame HELP!!!
« Válasz #2 Dátum: 2013. február 10. - 16:10:25 »
0 Show voters
Nos az a bajom, hogy ha van minigámeban 1 player és egy másik player is akar csatlakozni a minigámehoz akor öt nem teszi be minigámeba  csak annak müködik aki elinditja a minigámet lehet hogy abban van a baj amit én beletete

Nem elérhető Csabesz

  • 7827
    • Profil megtekintése
Minigame HELP!!!
« Válasz #3 Dátum: 2013. február 10. - 16:40:37 »
0 Show voters
minigáme?

Minigame HELP!!!
« Válasz #4 Dátum: 2013. február 10. - 17:35:33 »
0 Show voters
ja az

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal