Szerző Téma: Help  (Megtekintve 661 alkalommal)

Help
« Dátum: 2010. július 04. - 16:24:16 »
0 Show voters
Sziasztok én írtam a versenyes FS t de amikor /join olni szeretnék kiírja hogy most épp nincs verseny pedig kéne mert akkor íraja ki hogy csatlakozz a versenyhez valaki megnézné?
 

#include <a_samp>
#define MAX_RACES 200
#pragma tabsize 0
#define COLOR_GREEN 0x33AA33AA
new Time53;
new Text:CPTD[MAX_PLAYERS];
new Text:RaceTD;
#define red 0xff0000a7
public OnFilterScriptInit()
{
   RaceTD = TextDrawCreate(512.000000, 123.000000, \"New Textdraw\");
TextDrawBackgroundColor(RaceTD, -16776961);
TextDrawFont(RaceTD, 1);
TextDrawLetterSize(RaceTD, 0.300000, 1.000000);
TextDrawColor(RaceTD, -65281);
TextDrawSetOutline(RaceTD, 1);
TextDrawSetProportional(RaceTD, 1);
SetTimer(\"RandomCheck\", 100000, true);
CreateRace(\"Drift1\",800);
AddRaceCheckpoint(\"Drift 1\",-302.488464,1508.550781,75.359375);
AddRaceCheckpoint(\"Drift 1\",-295.235290,1410.807861,72.289833);
AddRaceCheckpoint(\"Drift 1\",-340.304504,1443.435180,66.576660);
AddRaceCheckpoint(\"Drift 1\",-364.088989,1415.940185,59.457977);
AddRaceCheckpoint(\"Drift 1\",-360.653350,1349.431030,48.191215);
AddRaceCheckpoint(\"Drift 1\",-425.954589,1445.732910,34.342815);
AddRaceCheckpoint(\"Drift 1\",-455.253906,1559.272094,36.502696);
AddRaceCheckpoint(\"Drift 1\",-428.102569,1656.503051,35.839267);
AddRaceCheckpoint(\"Drift 1\",-408.576232,1919.086547,57.383338);
AddRaceCheckpoint(\"Drift 1\",-425.414703,1807.669555,68.431144);
AddRaceCheckpoint(\"Drift 1\",-469.718902,1851.445068,80.439414);
AddRaceCheckpoint(\"Drift 1\",-380.479248,2071.297851,60.344608);
AddRaceCheckpoint(\"Drift 1\",-425.414703,1807.669555,68.431144);
AddRaceCheckpoint(\"Drift 1\",-533.548217,1995.632934,59.856506);
 
return 1;
}
 
new VehicleNames[212][] = {
\"Landstalker\",  \"Bravura\",  \"Buffalo\", \"Linerunner\", \"Perennial\", \"Sentinel\",
\"Dumper\",  \"Firetruck\" ,  \"Trashmaster\" ,  \"Stretch\",  \"Manana\",  \"Infernus\",
\"Voodoo\", \"Pony\",  \"Mule\", \"Cheetah\", \"Ambulance\",  \"Leviathan\",  \"Moonbeam\",
\"Esperanto\", \"Taxi\",  \"Washington\",  \"Bobcat\",  \"Mr Whoopee\", \"BF Injection\",
\"Hunter\", \"Premier\",  \"Enforcer\",  \"Securicar\", \"Banshee\", \"Predator\", \"Bus\",
\"Rhino\",  \"Barracks\",  \"Hotknife\",  \"Trailer\",  \"Previon\", \"Coach\", \"Cabbie\",
\"Stallion\", \"Rumpo\", \"RC Bandit\",  \"Romero\", \"Packer\", \"Monster\",  \"Admiral\",
\"Squalo\", \"Seasparrow\", \"Pizzaboy\", \"Tram\", \"Trailer\",  \"Turismo\", \"Speeder\",
\"Reefer\", \"Tropic\", \"Flatbed\",\"Yankee\", \"Caddy\", \"Solair\",\"Berkley\'s RC Van\",
\"Skimmer\", \"PCJ-600\", \"Faggio\", \"Freeway\", \"RC Baron\",\"RC Raider\",\"Glendale\",
\"Oceanic\", \"Sanchez\", \"Sparrow\",  \"Patriot\", \"Quad\",  \"Coastguard\", \"Dinghy\",
\"Hermes\", \"Sabre\", \"Rustler\", \"ZR-350\", \"Walton\",  \"Regina\",  \"Comet\", \"BMX\",
\"Burrito\", \"Camper\", \"Marquis\", \"Baggage\", \"Dozer\",\"Maverick\",\"News Chopper\",
\"Rancher\", \"FBI Rancher\", \"Virgo\", \"Greenwood\",\"Jetmax\",\"Hotring\",\"Sandking\",
\"Blista Compact\", \"Police Maverick\", \"Boxville\", \"Benson\",\"Mesa\",\"RC Goblin\",
\"Hotring Racer\", \"Hotring Racer\", \"Bloodring Banger\", \"Rancher\",  \"Super GT\",
\"Elegant\", \"Journey\", \"Bike\", \"Mountain Bike\", \"Beagle\", \"Cropdust\", \"Stunt\",
\"Tanker\", \"RoadTrain\", \"Nebula\", \"Majestic\", \"Buccaneer\", \"Shamal\",  \"Hydra\",
\"FCR-900\",\"NRG-500\",\"HPV1000\",\"Cement Truck\",\"Tow Truck\",\"Fortune\",\"Cadrona\",
\"FBI Truck\", \"Willard\", \"Forklift\",\"Tractor\",\"Combine\",\"Feltzer\",\"Remington\",
\"Slamvan\", \"Blade\", \"Freight\", \"Streak\",\"Vortex\",\"Vincent\",\"Bullet\",\"Clover\",
\"Sadler\",  \"Firetruck\", \"Hustler\", \"Intruder\", \"Primo\", \"Cargobob\",  \"Tampa\",
\"Sunrise\", \"Merit\", \"Utility Truck\", \"Nevada\", \"Yosemite\", \"Windsor\", \"Monster\",
\"Monster\",\"Uranus\",\"Jester\",\"Sultan\",\"Stratum\",\"Elegy\",\"Raindance\",\"RCTiger\",
\"Flash\",\"Tahoma\",\"Savanna\", \"Bandito\", \"Freight\", \"Trailer\", \"Kart\", \"Mower\",
\"Dune\", \"Sweeper\", \"Broadway\", \"Tornado\", \"AT-400\",  \"DFT-30\", \"Huntley\",
\"Stafford\", \"BF-400\", \"Newsvan\",\"Tug\",\"Trailer\",\"Emperor\",\"Wayfarer\",\"Euros\",
\"Hotdog\", \"Club\", \"Trailer\", \"Trailer\",\"Andromada\",\"Dodo\",\"RC Cam\", \"Launch\",
\"Police Car LSPD\", \"Police Car SFPD\",\"Police Car LVPD\",\"Police Ranger\",
\"Picador\",   \"S.W.A.T. Van\",  \"Alpha\",   \"Phoenix\",   \"Glendale\",   \"Sadler\",
\"Luggage Trailer\",\"Luggage Trailer\",\"Stair Trailer\", \"Boxville\", \"Farm Plow\",
\"Utility Trailer\"
};
enum RaceInfo
{
Name[70],
Float:X[200],
Float:Y[200],
Float:Z[200],
Vehicle,
CPNUM,
Timeout
};
new RaceID = -1;
new RaceI[MAX_RACES][RaceInfo];
new CurrentRace = -1;
new InRace[MAX_PLAYERS] = -1;
new RaceCPS[MAX_PLAYERS];
new RaceJoinable;
new CoUnTDown, CDTIME;
new LastCP[MAX_PLAYERS];
new RaceTime[MAX_PLAYERS];
new RacePos;
new Racee;
 
stock CreateRace(RaceName[], RaceTimeout, vehicle = -1)
{
RaceID++;
format(RaceI[RaceID][Name], 70, \"Race:%s\", RaceName);
RaceI[RaceID][Vehicle] = vehicle;
RaceI[RaceID][Timeout] = RaceTimeout;
return RaceID;
}
public OnPlayerConnect(playerid)
{
InRace[playerid] = 0;
TextDrawDestroy(CPTD[playerid]);
TextDrawHideForPlayer(playerid, RaceTD);
LastCP[playerid] = 0;
RaceTime[playerid] = 0;
RaceCPS[playerid] = -1;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new Yesss;
for(new i; i<MAX_PLAYERS; i++)
{
       if(InRace == 1) Yesss = 1;
}
if(Yesss == 0)
{
       CurrentRace = -1;
      KillTimer(Time53);
        KillTimer(Racee);
}
TextDrawDestroy(CPTD[playerid]);
TextDrawHideForPlayer(playerid, RaceTD);
return 1;
}
stock AddRaceCheckpoint(RaceName[], Float:x, Float:y, Float:z)
{
for(new ZZ; ZZ<MAX_RACES; ZZ++)
{
if(!strcmp(RaceName, RaceI[ZZ][Name]))
{
    RaceI[ZZ][X][RaceI[ZZ][CPNUM]] = x;
    RaceI[ZZ][Y][RaceI[ZZ][CPNUM]] = y;
    RaceI[ZZ][Z][RaceI[ZZ][CPNUM]] = z;
    RaceI[ZZ][CPNUM] ++;
    return 1;
}
}
return 0;
}
stock StartRace(RaceName[])
{
if(CurrentRace != -1) return 0;
   for(new ZZ; ZZ<MAX_RACES; ZZ++)
{
if(!strcmp(RaceName, RaceI[ZZ][Name]))
{
    CurrentRace = ZZ;
    new string[120];
    if(RaceI[ZZ][Vehicle] == -1)
    {
        format(string, 80, \"Verseny info: Race: %s A verseny hamarosan indul /join!\", RaceI[ZZ][Name]);
        
        
  
    }
    if(RaceI[ZZ][Vehicle] != -1)
    {
        format(string, 80, \"Verseny info: Race: %s /join hogy csatlakozz,Kötelezo kocsi!: %s\", RaceI[ZZ][Name], VehicleNames[RaceI[ZZ][Vehicle] - 400]);
    }
    SendClientMessageToAll(0x00D300AA, string);
    SendClientMessageToAll(0x00D300AA, \"Verseny info: 35mp mulva kezdodik a verseny!\");
    SetTimer(\"RaceStart\", 35000, false);
    RaceJoinable = 1;
    TextDrawSetString(RaceTD, RaceI[CurrentRace][Name]);
    return 1;
}
}
return 0;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new vehicleid = GetPlayerVehicleID(playerid);
new State = GetPlayerState(playerid);
   if(!strcmp(cmdtext, \"/join\", true))
   {
if(CurrentRace == -1) return SendClientMessage(playerid, red, \"Hiba:Most nincs verseny!\");
if(RaceJoinable == 0) return  SendClientMessage(playerid, red, \"Hiba:A verseny már elindult késon akarsz csatlakozni!\");
if(InRace[playerid] == 1) return SendClientMessage(playerid, red, \"Hiba:Már csatlakoztál a versenyhez\");
if(IsPlayerInAnyVehicle(playerid))
{
    
         
         
   InRace[playerid]=1;
    SetVehiclePos(vehicleid, RaceI[CurrentRace][X][0], RaceI[CurrentRace][Y][0], RaceI[CurrentRace][Z][0]);
    PutPlayerInVehicle(playerid,vehicleid,0);
}
else
{
 
SendClientMessage(playerid,red,\"Nincs kocsid? /v hogy szerezz!!\");
 
   RaceTime[playerid] = 0;
}
       CPTD[playerid] = TextDrawCreate(506.000000, 113.000000, \"Checkpoint: 13/100\");
TextDrawBackgroundColor(CPTD[playerid], 65535);
TextDrawFont(CPTD[playerid], 1);
TextDrawLetterSize(CPTD[playerid], 0.270000, 1.100000);
TextDrawColor(CPTD[playerid], 16777215);
TextDrawSetOutline(CPTD[playerid], 1);
TextDrawSetProportional(CPTD[playerid], 1);
new str[56];
format(str, 56, \"%d/%d\", RaceCPS[playerid], RaceI[CurrentRace][CPNUM]);
TextDrawSetString(CPTD[playerid], str);
TextDrawShowForPlayer(playerid, CPTD[playerid]);
TextDrawShowForPlayer(playerid, RaceTD);
SetPlayerPos(playerid, RaceI[CurrentRace][X][0], RaceI[CurrentRace][Y][0], RaceI[CurrentRace][Z][0]);
SetPlayerRaceCheckpoint(playerid, 0, RaceI[CurrentRace][X][0], RaceI[CurrentRace][Y][0], RaceI[CurrentRace][Z][0], RaceI[CurrentRace][X][1], RaceI[CurrentRace][Y][1], RaceI[CurrentRace][Z][1], 11);
InRace[playerid] = 1;
return 1;
}
   if(!strcmp(cmdtext, \"/leave\", true))
   {
       if(InRace[playerid] != 1) return SendClientMessage(playerid, 0x00D300AA, \"Nem vagy versenyben\");
DisablePlayerRaceCheckpoint(playerid);
InRace[playerid] = 0;
RaceCPS[playerid] = 0;
GameTextForPlayer(playerid, \"~r~Kiléptél a versenybol!\", 3000, 3);
SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), 0);
SetPlayerVirtualWorld(playerid, 0);
new Yesss;
for(new i; i<MAX_PLAYERS; i++)
{
          if(InRace == 1 && RaceCPS != 0) Yesss = 1;
}
if(Yesss == 1)
{
          CurrentRace = -1;
       KillTimer(Time53);
           KillTimer(Racee);
}
TextDrawDestroy(CPTD[playerid]);
TextDrawHideForPlayer(playerid, RaceTD);
return 1;
}
return 0;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
   PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
if(InRace[playerid] == 1)
{
new str[56];
format(str, 56, \"Checkpoints: %d/%d\", RaceCPS[playerid] + 1, RaceI[CurrentRace][CPNUM]);
TextDrawSetString(CPTD[playerid], str);
if(LastCP[playerid] == 1)
{
    new TimeM, TimeS;
   TimeS = RaceTime[playerid];
   while(TimeS > 59)
   {
       TimeS = TimeS - 60;
       TimeM ++;
   }
    DisablePlayerRaceCheckpoint(playerid);
    RacePos++;
    new Str[150], Str2[150];
    if(TimeM < 1)
   {
              format(Str, 100, \"~g~Beértél a célba!~n~~y~Pozíciód: %d Time:%d mp\", RacePos, TimeS);
              format(Str2, 100, \"Beértél a célba! Pozíciód:%d Time:%d seconds\", RacePos, TimeS);
   }
   if(TimeM > 0)
   {
       if(TimeS < 10)
       {
           format(Str, 100, \"~g~Beértél a célba!~n~~y~Position: %d Time:%d:0%d\", RacePos, TimeM, TimeS);
         format(Str2, 100, \"Beértél a célba! Pozíciód: %d Time:%d:0%d\", RacePos, TimeM, TimeS);
       }
       if(TimeS > 9)
       {
           format(Str, 100, \"~g~Beértél a célba!~n~~y~Position: %d Time:%d:%d\", RacePos, TimeM, TimeS);
         format(Str2, 100, \"Beértél a célba! Pozíciód: %d Time:%d:%d\", RacePos, TimeM, TimeS);
       }
   }
   TextDrawDestroy(CPTD[playerid]);
   TextDrawHideForPlayer(playerid, RaceTD);
   SendClientMessage(playerid, 0x00D300AA, Str2);
   GameTextForPlayer(playerid, Str, 3000, 3);
   InRace[playerid] = 0;
   LastCP[playerid] = 0;
   RaceCPS[playerid] = -2;
   new Yesss;
   for(new i; i<MAX_PLAYERS; i++)
   {
       if(InRace == 1) Yesss = 1;
   }
   if(Yesss == 0)
   {
       CurrentRace = -1;
       KillTimer(Time53);
               KillTimer(Racee);
   }
   SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), 0);
   SetPlayerVirtualWorld(playerid, 0);
   RaceTime[playerid] = 0;
}
    if(RaceCPS[playerid] != 0 && RaceCPS[playerid] != RaceI[CurrentRace][CPNUM] -1)
    {
   SetPlayerRaceCheckpoint(playerid, 0, RaceI[CurrentRace][X][RaceCPS[playerid] + 1], RaceI[CurrentRace][Y][RaceCPS[playerid] + 1], RaceI[CurrentRace][Z][RaceCPS[playerid] + 1], RaceI[CurrentRace][X][RaceCPS[playerid]+ 2], RaceI[CurrentRace][Y][RaceCPS[playerid] +2], RaceI[CurrentRace][Z][RaceCPS[playerid]+2], 8);
   RaceCPS[playerid] ++;
}
if(RaceCPS[playerid] == 0)
{
    GameTextForPlayer(playerid, \"~g~A verseny 35 ~r~ 35 ~p~ mp muva indul!!~n~ varj!...\", 35000, 3);
           new str2[56];
   format(str2, 56, \"Checkpoint: 0/%d\", RaceI[CurrentRace][CPNUM]);
   TextDrawSetString(CPTD[playerid], str2);
}
if(RaceCPS[playerid] == RaceI[CurrentRace][CPNUM]-1)
{
    SetPlayerRaceCheckpoint(playerid, 1, RaceI[CurrentRace][X][RaceCPS[playerid]], RaceI[CurrentRace][Y][RaceCPS[playerid]], RaceI[CurrentRace][Z][RaceCPS[playerid]], RaceI[CurrentRace][X][RaceCPS[playerid]+ 1], RaceI[CurrentRace][Y][RaceCPS[playerid] +1], RaceI[CurrentRace][Z][RaceCPS[playerid]+1], 8);
    LastCP[playerid] = 1;
}
}
 
return 1;
}
forward RaceStart();
public RaceStart()
{
for(new i; i<MAX_PLAYERS; i++)
{
    if(InRace == 1)
    {
        if(!IsPlayerInRaceCheckpoint(i))
   {
       TextDrawDestroy(CPTD);
      TextDrawHideForPlayer(i, RaceTD);
      GameTextForPlayer(i, \"~r~Elrontottad a versenyt.Nem mentél át az ellenorzo ponton.\", 3000, 3);
      DisablePlayerRaceCheckpoint(i);
      InRace = 0;
      continue;
   }
   new VEH = GetPlayerVehicleID(i);
   if(GetVehicleModel(VEH) != RaceI[CurrentRace][Vehicle] && RaceI[CurrentRace][Vehicle] != -1)
   {
               TextDrawDestroy(CPTD);
      TextDrawHideForPlayer(i, RaceTD);
       GameTextForPlayer(i, \"~r~Elrontottad a versenyt mert elromlott a kocsid!\", 3000, 3);
               InRace = 0;
               DisablePlayerRaceCheckpoint(i);
      continue;
   }
        TogglePlayerControllable(i, false);
        GameTextForPlayer(i, \"~g~Verseny ~r~Indulás!Rajt!\", 1000, 3);
    }
}
new Paaaaaa;
for(new i; i<MAX_PLAYERS; i++)
{
    if(InRace == 1) Paaaaaa = 1;
}
if(Paaaaaa == 0)
{
    CurrentRace = -1;
    SendClientMessageToAll(0x00D300AA, \"RACEINFO: Senki sem csatlakozott a versenyhez, így nem indult.\");
    return 1;
}
RaceJoinable = 0;
CDTIME = SetTimer(\"CountdowN\", 1000, true);
CoUnTDown = 5;
return 1;
}
forward CountdowN();
public CountdowN()
{
 
for(new i; i<MAX_PLAYERS; i++)
{
    if(InRace == 1)
    {
        if(CoUnTDown == 0)
   {
       GameTextForPlayer(i, \"~g~Go!!!!!!!!!\", 3000, 3);
       RacePos= 0;
       SetPlayerRaceCheckpoint(i, 0, RaceI[CurrentRace][X][1], RaceI[CurrentRace][Y][1], RaceI[CurrentRace][Z][1], RaceI[CurrentRace + 1][X][2], RaceI[CurrentRace + 1][Y][2], RaceI[CurrentRace + 1][Z][2], 5);
               RaceCPS = 1;
               TogglePlayerControllable(i, true);
               Time53 = SetTimer(\"RaceTimer\", 1000, true);
               
   }
   if(CoUnTDown > 0)
   {
      new str[5];
      format(str, sizeof(str), \"~r~%d\", CoUnTDown);
      GameTextForPlayer(i, str, 900, 3);
   }
}
}
   if(CoUnTDown == 0)
{
    Racee = SetTimer(\"RaceEnd\", RaceI[CurrentRace][Timeout]*1000, false);
KillTimer(CDTIME);
}
CoUnTDown --;
return 1;
}
forward RaceEnd(playerid);
public RaceEnd(playerid)
{
 
for(new i; i<MAX_PLAYERS; i++)
{
    if(InRace == 1)
    {
        SendClientMessage(i, 0x00D300AA, \"Te nem fejezted be a versenyt idoben!\");
        GameTextForPlayer(i, \"~r~Te nem fejezted be a versenyt idoben!\", 3000, 3);
        DisablePlayerRaceCheckpoint(i);
   InRace = 0;
   RaceCPS = 0;
   CurrentRace = -1;
   SetVehicleVirtualWorld(GetPlayerVehicleID(i), 0);
   SetPlayerVirtualWorld(i, 0);
   TextDrawDestroy(CPTD);
   TextDrawHideForPlayer(i, RaceTD);
 
}
 
KillTimer(Time53);
 
}
return 1;
}
forward RandomCheck();
public RandomCheck()
{
if(CurrentRace != -1) return 1;
new Rand = random(RaceID+1);
StartRace(RaceI[Rand][Name]);
return 1;
}
forward RaceTimer();
public RaceTimer()
{
for(new i; i<MAX_PLAYERS; i++)
{
    if(InRace == 1)
    {
        RaceTime ++;
    }
}
return 1;
}

 
Nagyon megköszönném ha valaki megoldaná :D
lenne még1 kérdésem ojan mozgó objectet hogylehet csinálni ami 10 másodpercenként autómatikusan kinyílik 3 másodpercet nyitvavan és magátol becsukódik?
elore is köszi
« Utoljára szerkesztve: 2010. július 04. - 16:57:12 írta Pioneer »

Help
« Válasz #1 Dátum: 2010. július 04. - 19:33:18 »
0 Show voters

Sziasztok én írtam a versenyes FS t de amikor /join olni szeretnék kiírja hogy most épp nincs verseny pedig kéne mert akkor íraja ki hogy csatlakozz a versenyhez valaki megnézné?
 
[/quote]
Khmm..
Ezt régen nem te írtad...
KRace a neve. Fent volt eredeti forumon.
Amugy
 

forward Nyit();
forward Zar();
public OnFilterScriptInit()
{
   SetTimer(\"Nyit\", 10000, 0);
   return 1;
}
public Nyit()
{
   MoveObject, stb
   SetTimer(\"Zar\", 3000, 0);
   return 1;
}
public Zar()
{
   MoveObject, stb
   SetTimer(\"Nyit\", 10000, 0);
   return 1;
}

 


EDIT: Mekkora egy FOS Ez a forum.. Válasz küldése közben kb 20x írja ki h Unable to Connect to database... Te jó ég... Idegesíto!!

Help
« Válasz #2 Dátum: 2010. július 05. - 15:05:15 »
0 Show voters
Én nem ismerem az eredeti fórumot és nem is ismerek KRacet ezt egy minta aalapján csináltam am kösz
« Utoljára szerkesztve: 2010. július 05. - 16:57:48 írta Pioneer »

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal