Help -
Heress - 03.11.2018
https://pastebin.com/m0GpVCAH
This is commands to call Medic, Policeman and taxi worker.
How to do, what when worker arrives to client auto send message? ex.: "Paramedic arrived!"
Re: Help -
khRamin78 - 03.11.2018
you can use checkpoints to player position and when the medic got to checkpoint you send him a message or you can use onplayerupdate if player is streamed in with otherplayer which called the medic just send him the message
so in total
usefull functions :
IsVehicleStreamedIn <To check the medic vehicle stream in on player update>
IsPlayerStreamedIn
those functions should be usefull in OnPlayerUpdate
or use of checkpoints
Re: Help -
Heress - 03.11.2018
Quote:
Originally Posted by khRamin78
you can use checkpoints to player position and when the medic got to checkpoint you send him a message or you can use onplayerupdate if player is streamed in with otherplayer which called the medic just send him the message
so in total
usefull functions :
IsVehicleStreamedIn <To check the medic vehicle stream in on player update>
IsPlayerStreamedIn
those functions should be usefull in OnPlayerUpdate
or use of checkpoints
|
Did possible to create invisible checkpoint?
Re: Help -
khRamin78 - 03.11.2018
Quote:
Originally Posted by Heress
Did possible to create invisible checkpoint?
|
no its not possible maybe using checkpoints with different interior and vw with streamer would do that but its useless you can use like this if yo want something invisible
PHP Code:
publice OnPlayerUpdate(playerid)
{
if(IsPlayerCalled[playerid])
{
if(IsPlayerStreamedIn(PlayerCallAccepterId))
{
SendMessage("Paramedic Arrived");
IsPlayerCalled[playerid] = false;
}
}
return 1;
}
Re: Help -
Heress - 03.11.2018
https://pastebin.com/m0GpVCAH
What PlayerCallAcceptedId should be in my code?
Floats tx, ty and tz is global
Re: Help -
lollypap54 - 03.11.2018
Just check the distance between the worker and the caller every second, if distance is <30 for example, send the message.
Useful functions: SetTimer, GetPlayerDistanceFromPoint
I suggest creating variable called: iskvietejoID[MAX_PLAYERS];
Re: Help -
Heress - 03.11.2018
Quote:
Originally Posted by lollypap54
Just check the distance between the worker and the caller every second, if distance is <30 for example, send the message.
Useful functions: SetTimer, GetPlayerDistanceFromPoint
I suggest creating variable called: iskvietejoID[MAX_PLAYERS];
|
Logiљka, o kaip turėtų atrodyti update timer'is? SetTimer("DistanceUpdateTimer", 1000 ...ir kaip toliau?
It's logic. How will look update timer?
Re: Help -
lollypap54 - 03.11.2018
Timerio kvietimas, gali į main() arba OnGameModeInit() dėt:
Code:
SetTimer("OnOneSecondPass", 1000, true);
Tas kintamasis:
Code:
new iskvietejoID[MAX_PLAYERS];
Jį reikėtų nustatyt į INVALID_PLAYER_ID iљ pradћių(nu nes jokio iљkvietėjo dar nebūna xd):
Code:
public OnPlayerConnect(playerid)
{
iskvietejoID[playerid] = INVALID_PLAYER_ID;
}
Toliau, /priimti komandoj kai jau gauni targetid raљai:
Code:
iskvietejoID[playerid] = targetid;
Dabar su ta 1 sekunde (P.S patariu loopint ћaidėjus su foreach, raљau su tuo MAX_PLAYERS tik dėl to, kad tu taip raљai):
Code:
forward OnOneSecondPass();
public OnOneSecondPass()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(iskvietejoID[i] != INVALID_PLAYER_ID)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(i, x, y, z);
new Float:atstumas = GetPlayerDistanceFromPoint(iskvietejoID[i], x, y, z);
if(atstumas <= 30.0)
{
SendClientMessage(iskvietejoID[i], -1, "Medikas atvyko (čia tikrinsi pagal profesiją)");
iskvietejoID[i] = INVALID_PLAYER_ID;
}
}
}
}
}
Bet dar ne viskas, jeigu iљkvietėjas atsijungtų, tas tikrinimas toliau eitų, tai tau reik daryt:
Code:
public OnPlayerDisconnect(playerid, reason)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(iskvietejoID[i] == playerid)
{
SendClientMessage(i, -1, "Tavo klientas atsijungė");
iskvietejoID[i] = INVALID_PLAYER_ID;
}
}
}
}
Nu va, tikiuos viskas čia gerai xd
Re: Help -
Heress - 03.11.2018
Dėkui labai tau
rep duosiu
viskas net aiškiau pasidaro xdd
Re: Help -
khRamin78 - 03.11.2018
Quote:
Originally Posted by lollypap54
Just check the distance between the worker and the caller every second, if distance is <30 for example, send the message.
Useful functions: SetTimer, GetPlayerDistanceFromPoint
I suggest creating variable called: iskvietejoID[MAX_PLAYERS];
|
why ? there is no need of another timer for each second when there is almost a timer
public OnPlayerUpdate
Re: Help -
Heress - 03.11.2018
Quote:
Originally Posted by khRamin78
why ? there is no need of another timer for each second when there is almost a timer
public OnPlayerUpdate
|
whatever i already fixed it
Re: Help -
khRamin78 - 03.11.2018
Quote:
Originally Posted by Heress
whatever i already fixed it
|
fixxing it in bad way isnt good idea anyway goodluck
Re: Help -
lollypap54 - 03.11.2018
OnPlayerUpdate callback happens about 30 times a second, so we use it when we REALLY need it, for this 1 second check is enough