Jump to content
  • 0

pomoc POMOC s gamemodom


E1r2i3k4

Dotaz

Cawte všetci, mám problém v gamemode, konkrétne s pickupom. Dám to na server ale mi ho nezobrazí, Kód:

 

new taxipic;
 

public OnGameModeInit()
{

taxipic = CreatePickup(1274,1,2189.0688,1816.0016,10.8203);

 

return 1;

}

 

public OnPlayerPickUpPickup(playerid, pickupid)
{
 
    if(pickupid == taxipic)
    {
 
GameTextForPlayer(playerid,"~r~[ ! ] ~w~Ak sa chces stat taxikarom napis ~n~~g~/taxikar",5000, 4);
 
return 1;
 
    }
 
return 0;
 
}
 
Dík.
Link to comment
Share on other sites

10 odpovědí na tuto otázku

Recommended Posts

  • 0

V gamemode, tu máš všetko čo sa týka zamestnania:
 

new taxikar[MAX_PLAYERS];
new taxipic;

public OnGameModeInit()
{
taxipic = CreatePickup(1274,1,2189.0688,1816.0016,10.8203);
return 1;
}
 
public OnPlayerSpawn(playerid)
{
new cesta[100];
    new meno[MAX_PLAYER_NAME];
    GetPlayerName(playerid,meno, sizeof(meno));
    format(cesta, sizeof(cesta), "%s.sav", meno);
    if(dini_Bool(cesta, "taxikar") == 1)
    {
GivePlayerWeapon(playerid, dini_Int(cesta, "taxikarZBRAN2"), 500);
GivePlayerWeapon(playerid, dini_Int(cesta, "taxikarZBRAN3"), 500);
SetPlayerPos(playerid, dini_Float(cesta, "taxikarSPAWN1"), dini_Float(cesta, "taxikarSPAWN2"), dini_Float(cesta, "taxikarSPAWN3"));
}
else
{
SetPlayerPos(playerid,1675.248291, 1309.559326,10.820300);
}
return 1;
}
 
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == taxipic)
    {
InfoBox(playerid,3,"~r~[ ! ] ~w~Ak sa chces stat taxikarom napis ~n~~g~/taxikar");
return 1;
    }
return 0;
}
 
CMD:taxikar(playerid, params [])
{
if(IsPlayerInSphere(playerid, 2189.0688,1816.0016,10.8203, 5) == 1)
{
   new cesta[100];
      new meno[MAX_PLAYER_NAME];
      GetPlayerName(playerid,meno, sizeof(meno));
    format(cesta, sizeof(cesta), "%s.sav", meno);
   if(dini_Bool(cesta, "taxikar") == 1) return SendClientMessage(playerid, 0xFF0000FF, "{FF0000}[ ! ] {FFFFFF}Už si taxikárom");
   SendClientMessage(playerid, 0xFF0000FF, "{FF0000}[ ! ] {FFFFFF}Stal si sa taxikárom");
   GivePlayerWeapon(playerid, 4, 500);
   GivePlayerWeapon(playerid, 22, 500);
   GivePlayerWeapon(playerid, 5, 500);
   taxikar[playerid] = 1;
    dini_BoolSet(cesta, "taxikar", 1);
dini_IntSet(cesta, "taxikarZBRAN2", 22);
dini_IntSet(cesta, "taxikarZBRAN3", 5);
dini_FloatSet(cesta, "taxikarSPAWN1", 2184.2537);
dini_FloatSet(cesta, "taxikarSPAWN2", 1815.6729);
dini_FloatSet(cesta, "taxikarSPAWN3", 10.8203);
}
else
{
SendClientMessage(playerid, 0xFF000FF, "{FF0000}[ ! ] {FFFFFF}Musíš byť pri zamestnaní TAXIKAR v LV");
}
return 1;
}
 
CMD:vypoved(playerid, params [])
{
SendClientMessage(playerid, 0xFF000FF, "{FF0000}[ ! ] {FFFFFF}Dal si výpoveď zo zamestnania");
//TAXI=========================================================
new cesta[100];
    new meno[MAX_PLAYER_NAME];
    GetPlayerName(playerid,meno, sizeof(meno));
format(cesta, sizeof(cesta), "%s.sav", meno);
if(dini_Bool(cesta, "taxikar") == 1)
{
taxikar[playerid] = 0;
dini_BoolSet(cesta, "taxikar", 0);
dini_IntSet(cesta, "taxikarZBRAN1", 0);
dini_IntSet(cesta, "taxikarZBRAN2", 0);
dini_IntSet(cesta, "taxikarZBRAN3", 0);
dini_FloatSet(cesta, "taxikarSPAWN1", 1675.2483);
dini_FloatSet(cesta, "taxikarSPAWN2", 1309.5593);
dini_FloatSet(cesta, "taxikarSPAWN3", 10.8203);
}
return 1;
}
 
Myslím že všetko už som napísal :d
Link to comment
Share on other sites

  • 0

IsPlayerInSphere??
WTF?!
Použi IsPlayerInRangeOfPoint.
Ďalej ak budú hráči 5 na serveri a furt budú dávať /taxikar na tom mieste tak ti lagnú server.
A ešte, pri tom pickupe musíš zadať myslím aj virtual world na konci, pozri si wiki.
Ďalšia chyba je, že aj ked si taxikar, môžeš opäť použiť /taxikar.

Link to comment
Share on other sites

  • 0

Budu predpokladat ze tim nezobrazi myslis ze se pickup nezobrazi (koneckoncu tak sj ito napsal).

Pokud CreatePickupz nezadas virtual world je defaultne 0. Takze se ujisti jestli jsi ve virtualu 0 nebo nastav pickupu -1 timpadem se bude zobrazovat ve vsechn VW.

Použi IsPlayerInRangeOfPoint.

Treba to mas pres define, to pak uz je jedno co si tam pise.

Link to comment
Share on other sites

  • 0

Ešte je tu možnosť že sa mu kód zastaví pred tým, než sa dostane k pickupu. (Proste sa ti ta funkcia CreatePickup nevyvolá pretože sa nedokončí public OnGameModeInit)

 

Môže to byť spôsobené nesprávnym returnom. Odporúčam si to skontrolovať (za CreatePickup daj print("Ok funguje"); a pozri sa či to vypísalo.)

Link to comment
Share on other sites

  • 0

Hmm, na konci nechaj return 1;

máš v OnGameModeInit nejaký cyklus ? viem že to ukončí kód keď sa použije neexistujúca premenná...

 

Pre objasnenie : 

new premenna[10]; // vytvorím premennu s polom 10

premenna[10] = 1; // zapíšem do neexistujúcej premennej (pretože som vytvoril len od 0-9)

print("..."); // toto sa už nevykoná

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...