Jump to content
  • 0

pomoc kam to vložit?


matajus

Dotaz

Čau , potřeboval bych se zeptat do jakého publicu mám vložit toto:

if(IsPlayerInRangeOfPoint(playerid, 6.0, -1836.3822,132.5754,15.4022))
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid, COLOR_WHITE, "Musíš být řidič");
return 1;
}
ShowPlayerDialog(playerid, NEON, DIALOG_STYLE_LIST, "Vyberte si barvu neonu :","Modrá (5 000$)\nZelená(5 500$)\nŽlutá(4 000$)\nBílá(3 500$)\nRůžová(3 800$)\nOdstranit Neony (100 $)","Koupit","Nic");
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Musíš být ve vozidle");
}
}

FUNKCE:

má se zobrazit dialog s neony když je hráč vzdálen od 1 místa 6m , nevím do jakého publicu to hodit aby to fungovalo správně

Link to comment
Share on other sites

18 odpovědí na tuto otázku

Recommended Posts

  • 0
  • Globální moderátor

if(IsPlayerInRangeOfPoint(playerid, 6.0, -1836.3822,132.5754,15.4022))

 

změň si range

 

Více info: http://wiki.sa-mp.com/wiki/IsPlayerInRangeOfPoint

 

 

EDIT:

Ne sry, blbě jsem si přečetl otázku :) No někam kde je ten public často vyvolán.

Link to comment
Share on other sites

  • 0
udělej si třeba public ..

 

forward public(playerid);

 

public public(playerid)

{

// sem to dej

return true;

}

 

Zapomněl jsi timer.

Navíc bych to spíš udělal přes public bez parametrů, SetTimer a optimalizovaný cyklus. ;)

Link to comment
Share on other sites

  • 0

udělal jsem to takto jak jte mi radili :

 

forward neonpub(playerid);

 

SetTimer("neonpub",1000,1);

 

public neonpub(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 6.0, -1836.3822,132.5754,15.4022))
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid, COLOR_WHITE, "Musíš být řidič");
return 1;
}
ShowPlayerDialog(playerid, NEON, DIALOG_STYLE_LIST, "Vyberte si barvu neonu :","Modrá (5 000$)\nZelená(5 500$)\nŽlutá(4 000$)\nBílá(3 500$)\nRůžová(3 800$)\nOdstranit Neony (100 $)","Koupit","Nic");
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Musíš být ve vozidle");
}
}
if (IsPlayerInSphere(playerid, 362.4413,173.4329,1008.3828,3) == 1)
{
ShowPlayerDialog(playerid,infa,DIALOG_STYLE_MSGBOX,"Informace","Nyní se nacházíš na Městském úřadě! Zde si můžeš zřídit všemožné potřebné věci ke hraní!","Ok","Konec");
}
return true;
}

 

a nejede :(

Link to comment
Share on other sites

  • 0

Neudělal jsi to tak jak jsme radili, když dáš SetTimer, tak se ti nepřenese hodnota (playerid) do toho publicu, takže buď použij SetTimerEx nebo tam dej cyklus for, public nech bez parametrů a přes ten cyklus určuj playerid, samozřejmě nesmí chybět IsPlayerConnected.

public ... {
for {
IsPlayerConnected {
//tvůj kod
}
}
return
}

Link to comment
Share on other sites

  • 0

Petr- nešlo by timer smazat a dát ten public do OnPlayerUpdate ?

 

-- ned 19. čer 2011 10:45:56 --

 

if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid, COLOR_WHITE, "Musíš být řidič");
return 1;
}

 

nemá být return false; ?

Link to comment
Share on other sites

  • 0

OnPlayerUpdate: This callback is called everytime a client/player updates the server with their status.

 

Víš jak často to nastane během jediné sekundy? No a ty by to takhle vyvolával pro každého hráče zvlášť. Bylo by to sice nejpřesnější, ale zatěžovalo by to pěkně, pokud by jsi měl na serveru víc lidí.

 

Ten timer se ti přece jen vyvolává méněkrát, je pravda že je tam cyklus, ale pokud to zoptimalizuje podle návodu, co tu mám, tak to bude zatěžovat několikrát méně, než to s tím OnPlayerUpdate (při větší návštěvnosti)

Link to comment
Share on other sites

  • 0

Když to dám takto :

public neonpub(playerid)
{
for
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInRangeOfPoint(playerid, 6.0, -1836.3822,132.5754,15.4022))
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid, COLOR_WHITE, "Musíš být řidič");
return 1;
}
ShowPlayerDialog(playerid, NEON, DIALOG_STYLE_LIST, "Vyberte si barvu neonu :","Modrá (5 000$)\nZelená(5 500$)\nŽlutá(4 000$)\nBílá(3 500$)\nRůžová(3 800$)\nOdstranit Neony (100 $)","Koupit","Nic");
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Musíš být ve vozidle");
}
}
}
return 1;
}

 

tak mi to vypíše error:

C:\Documents and Settings\Renek\Dokumenty\HRY\SAMP\samp03csvr_win32(2)\gamemodes\worldgta.pwn(12563 -- 12564) : error 029: invalid expression, assumed zero

Link to comment
Share on other sites

  • 0

dobře přečet, ale když tam dám for

for(new i=0; i

 
tak mi to zase dá error:
[code]C:\Documents and Settings\Renek\Dokumenty\HRY\SAMP\samp03csvr_win32(2)\gamemodes\worldgta.pwn(12585) : error 030: compound statement not closed at the end of file (started at line 12562)
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...