Sziasztok!
Rég volt segitségre szükségem de mosts
ismét van. talán a családi okok miatt nemtudok figyelni
vagy nemtudom de valahogy muszály elterelnem a figyelmem a dolgokrol
ezért irtam egy trafipax parancsot ami nem csinál semmit sem.
az addig oké hogy \"lerakja a trafipaxot\" de ha elmegy valaki ott akkor nemcsin semmit sem. itt a
parancs:
if(strcmp(cmd, \"/trafipax\", true) == 0 || strcmp(cmd, \"/trafi\", true) == 0)
{
if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 1)
{
new Float: sebesseg;
new Float: x, y, z;
GetPlayerPos(playerid, Float:x, Float:y, Float:z);
SendClientMessage(playerid, COLOR_PURPLE, \"* Elehelyeztél egy trafipaxot.\");
new celpont = GetClosestPlayer(playerid);
if(PlayerToPoint(20, playerid, x, y, z))
{
if(IsPlayerInAnyVehicle(celpont))
{
sebesseg = GetSpeed(celpont);
SendClientMessage(playerid, COLOR_YELLOW, \"_________ * TRAFIPAX * _________\");
format(string, sizeof(string), \"Sebesség: %d km/h\", sebesseg);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
}
return 1;
}
aki tud kérem segitsen :)
zsomaa
Ahogy látom ez csak akkor fogja megadni a legközelebbi játékos sebességét, ha elég közel van hozzád, és pont akkor, amikor beírtad a parancsot. Ezt idõzítõvel meg lehetne szerintem oldani, lehet elgondolkozok rajta mindjárt.
Ja, és a traffipax két f. ;)
Próbáld meg ezt, nem tudtam tesztelni:
public Traffipax( Float: x, Float: y, Float: z, traffipaxer );
public OnPlayerCommandText( playerid, cmdtext[ ] ) {
if(strcmp(cmdtext, \"/trafipax\", true) == 0 )
{
if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 1)
{
new Float: x, Float: y, Float: z;
GetPlayerPos(playerid, x, y, z);
SendClientMessage(playerid, COLOR_PURPLE, \"* Elehelyeztél egy traffipaxot.\");
SetTimerEx( \"Traffipax\", 1000, true, \"fffd\", x, y, z, playerid );
}
return 1;
}
return 0;
}
public Traffipax( Float: x, Float: y, Float: z, traffipaxer ) {
for( new p = 0; p < MAX_PLAYERS; ++p ) {
if( !IsPlayerConnected( p ) || IsPlayerNPC( p ) || !IsPlayerInAnyVehicle( p ) || !PlayerToPoint( 20.0, p, x, y, z ) ) continue;
SendClientMessage(traffipaxer, COLOR_YELLOW, \"_________ * TRAFFIPAX * _________\");
format(string, sizeof(string), \"Sebesség: %d km/h\", GetSpeed(p));
SendClientMessage(traffipaxer, COLOR_WHITE, string);
}
}
}
Az idõzítõ ismétlõdési idejét ha lentebb veszed, valamint ha a PlayerToPoint függvény elsõ paraméterének értékét megnöveled, akkor még pontosabb lesz, de lassíthatja is a szervered. Ki kell kísérletezned a megfelelõ beállítást, én csak vaktában írtam ezt. ;)