need help with a public function
#1

hey guys, i'm trying to make my own event filterscript, works well so far but i have got a problem.

I currently have vehicle derbies ontop of a building and im adding a public function so that when a player falls off a building they lose and get kicked out of the event. currently whenever a player joins an event from less than 90 metres up in the sky, it kicks them instantly as soon as they join the event. im wondering how i can possibly delay the function by a few seconds so it gives the player enough time to spawn onto the building before it starts checking for their Z position.

here is a snippet of my code

PHP код:
forward OnPlayerInEvent(playerid);
public 
OnPlayerInEvent(playerid)
{
    new 
Float:X;
    new 
Float:Y;
    new 
Float:Z;
    
GetPlayerPos(playeridXYZ);
    if (
90 && pInfo[playerid][pEventJoin] == && GetPlayerVirtualWorld(playerid) == 500 || 501 || 502){
    ForEach(
iMAX_PLAYERS){
    
pInfo[i][pEventJoin] = 0;
    
pInfo[i][pEventLost] = 1;
    }
    
SendClientMessage(playeridRED"You Fell Off the Building and have Lost the Derby!");
    
SetPlayerPos(playeridposX[playerid], posY[playerid], posZ[playerid]);//
    
SetPlayerFacingAngle(playeridposA[playerid]);                        // savepos and loadpos
    
SetPlayerInterior(playeridInterior[playerid]);                       //
    
SetPlayerVirtualWorld(playeridVirtualWorld[playerid]);//-------------//
    
}
    return 
1;

Reply
#2

I didn't understand you problem
Players kick from event before they join to the event ?
Where you use your function ?
Onplayerupdate ?
Try this:
First teleport players on top of buildings and then set their variable true
1.SetPlayerPos…
After that
2.pInfo[playerid][pEventJoin] = 1;
Hope i helped
If you mean somthing else reply..
Reply
#3

my event join cmd

PHP код:
CMD:ejoin(playeridparams[]){
if(
pInfo[playerid][pEventActive] == 0) return SendClientMessage(playeridRED"No Current Event Active");
if(
pInfo[playerid][pEventJoin] == 1) return SendClientMessage(playeridRED"You are Already in an Event!");
if(
pInfo[playerid][pEventLost] == 1) return SendClientMessage(playeridRED"You have already Lost, please wait until the next Event!");
if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER) return SendClientMessage(playeridRED"Please Exit your Vehicle Before Joining an Event!");
if(
GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playeridRED"Please Exit the Vehicle Before Joining an Event!");
if(
GetPlayerWantedLevel(playerid) >= 1) return SendClientMessage(playeridRED"Criminals Cannot Join Events!");
GetPlayerPos(playeridposX[playerid], posY[playerid], posZ[playerid]);//
GetPlayerFacingAngle(playeridposA[playerid]);                        //
Interior[playerid] = GetPlayerInterior(playerid);                      // savepos and loadpos
VirtualWorld[playerid] = GetPlayerVirtualWorld(playerid);              //
Saved[playerid] = 1;//-------------------------------------------------//
pInfo[playerid][pEventJoin] = 1//set player in event world = true
switch(pInfo[playerid][pEventNumber])
{
case 
1:
{
new 
string[24];
format(string,sizeof(string),"Bloodring Derby!");
GameTextForPlayer(playeridstring,5000,3);
SetPlayerPos(playerid2311.6377,2188.6648,103.8786);
SetPlayerInterior(playerid0);
SetPlayerVirtualWorld(playerid500); // virtual world event 1
ResetPlayerWeapons(playerid); // remove weapons
RemovePlayerAttachedObject(playerid, -1);
SendClientMessage(playeridLIME"You have Joined the Bloodring Derby, get inside a Vehicle and Wait for Further Instructions!");
}
case 
2:
{
new 
string[24];
format(string,sizeof(string),"Go-Kart Derby!");
GameTextForPlayer(playeridstring,5000,3);
SetPlayerPos(playerid2311.6377,2188.6648,103.8786);
SetPlayerInterior(playerid0);
SetPlayerVirtualWorld(playerid501); // virtual world event 2
ResetPlayerWeapons(playerid); // remove weapons
RemovePlayerAttachedObject(playerid, -1);
SendClientMessage(playeridLIME"You have Joined the Go-Kart Derby, get inside a Vehicle and Wait for Further Instructions!");
}
case 
3:
{
new 
string[24];
format(string,sizeof(string),"Sand King Derby!");
GameTextForPlayer(playeridstring,5000,3);
SetPlayerPos(playerid2311.6377,2188.6648,103.8786);
SetPlayerInterior(playerid0);
SetPlayerVirtualWorld(playerid502); // virtual world event 3
ResetPlayerWeapons(playerid);  // remove weapons
RemovePlayerAttachedObject(playerid, -1);
SendClientMessage(playeridLIME"You have Joined the Sand King Derby, get inside a Vehicle and Wait for Further Instructions!");
}
}
return 
1;

Reply
#4

If you use OnPlayerInEvent function in onplayerupdate callback, because onplayerupdate calls for every update maybe call before you set player pos on top of buildings
Just put this line:
pInfo[playerid][pEventjoin] =1;
After swich between event position and set player position
Just put this line at the end of your command
Reply
#5

I wouldn't bother with ResetPlayerWeapons(playerid,); I would just use SetPlayerArmedWeapon(playerid,0); it will set their weapon to slot 0, 0=fists as you may know. This will save you some time in scripting this and save you having to screw around with "else if" statements and variables. I know you're probably determined on doing it your own way, and good on ya. But this will save you some time if you just SetPlayerArmedWeapon(playerid, 0); instead of having to GetPlayerWeapon(playerid, 0) then call back the weapons at the end of every event or when a player is kicked/dies in the event (in your case falling off a building).



PHP код:
CMD:ejoin(playeridparams[]){ 
if(
pInfo[playerid][pEventActive] == 0) return SendClientMessage(playeridRED"No Current Event Active"); 
if(
pInfo[playerid][pEventJoin] == 1) return SendClientMessage(playeridRED"You are Already in an Event!"); 
if(
pInfo[playerid][pEventLost] == 1) return SendClientMessage(playeridRED"You have already Lost, please wait until the next Event!"); 
if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER) return SendClientMessage(playeridRED"Please Exit your Vehicle Before Joining an Event!"); 
if(
GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playeridRED"Please Exit the Vehicle Before Joining an Event!"); 
if(
GetPlayerWantedLevel(playerid) >= 1) return SendClientMessage(playeridRED"Criminals Cannot Join Events!"); 
GetPlayerPos(playeridposX[playerid], posY[playerid], posZ[playerid]);// 
GetPlayerFacingAngle(playeridposA[playerid]);                        // 
Interior[playerid] = GetPlayerInterior(playerid);                      // savepos and loadpos 
VirtualWorld[playerid] = GetPlayerVirtualWorld(playerid);              // 
Saved[playerid] = 1;//-------------------------------------------------// 
pInfo[playerid][pEventJoin] = 1//set player in event world = true 
switch(pInfo[playerid][pEventNumber]) 

<
a href="http://cityadspix.com/tsclick-MIQCWPUV-GECAQBFF?url=http%3A%2F%2Fwww.sotmarket.ru%2Fproduct%2Fsumka-notebook-15-targus-cn-514-eu-50.html&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&bt=20&pt=9&lt=2&tl=3&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&im=ODI1LTAtMTQxNzc4MTM4My0xOTI4NTEyOQ%3D%3D&fid=NDQ1NzU2Nzc1&prdct=390931073505&kw=case%201" target="_blank" alt="<a href="http://cityadspix.com/tsclick-MIQCWPUV-GECAQBFF?url=http%3A%2F%2Fwww.sotmarket.ru%2Fproduct%2Fsumka-notebook-15-targus-cn-514-eu-50.html&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&bt=20&pt=9&lt=2&tl=3&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&im=ODI1LTAtMTQxNzc4MTQ1Mi0xMjMzMzA3MA%3D%3D&fid=NDQ1NzU2Nzc1&prdct=390931073505&kw=Targus%20Classic%2B%20Toploading%20Case%2013-14.1" target="_blank" alt="Targus Classic+ <a href="http://cityadspix.com/tsclick-MIQCWPUV-GECAQBFF?url=http%3A%2F%2Fwww.sotmarket.ru%2Fproduct%2Fsumka-notebook-15-targus-cn-514-eu-50.html&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&bt=20&pt=9&lt=2&tl=3&im=ODI1LTAtMTQxNzc4MTQ1Mi0xMzk4MDA5Nw%3D%3D&fid=NDQ1NzU2Nzc1&prdct=390931073505&kw=Toploading%20Case%2013-14.1" target="_blank" alt="Targus Classic+ Toploading <a href="http://cityadspix.com/tsclick-MIQCWPUV-GECAQBFF?url=http%3A%2F%2Fwww.sotmarket.ru%2Fproduct%2Fsumka-notebook-15-targus-cn-514-eu-50.html&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&bt=20&pt=9&lt=2&tl=3&im=ODI1LTAtMTQxNzc4MTQ1My0xOTMxOTY5Mw%3D%3D&fid=NDQ1NzU2Nzc1&prdct=390931073505&kw=Case%2013-14.1" target="_blank" alt="Targus Classic+ Toploading Case 13-14.1" title="Targus Classic+ Toploading Case 13-14.1" style="">Case 13-14.1</a>" title="Targus Classic+ Toploading Case 13-14.1" style="">Toploading Case 13-14.1</a>" title="Targus Classic+ Toploading Case 13-14.1" style="">Targus Classic+ Toploading Case 13-14.1</a>" title="Targus Classic+ Toploading Case 13-14.1" style="">case 1</a>: 

new 
string[24]; 
format(string,sizeof(string),"Bloodring Derby!"); 
GameTextForPlayer(playeridstring,5000,3); 
SetPlayerPos(playerid2311.6377,2188.6648,103.8786); 
SetPlayerInterior(playerid0); 
SetPlayerVirtualWorld(playerid500); // virtual world event 1 
SetPlayerArmedWeapon(playerid,0); // fists
RemovePlayerAttachedObject(playerid, -1); 
SendClientMessage(playeridLIME"You have Joined the Bloodring Derby, get inside a Vehicle and Wait for Further Instructions!"); 

<
a href="http://cityadspix.com/tsclick-GQBE4OE0-JHFDQUHP?url=http%3A%2F%2Fogo1.ru%2Fmarket%2Fsumki_dlya_noutbukov%2F56549-10-amp-quot-Sumka-Targus-TSS112EU-Blue&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&bt=20&pt=9&lt=2&tl=3&im=OTY1NS0wLTE0MTc3ODEzODMtMTU2MDQ4OTA%3D&fid=NDQ1NzU2Nzc1&prdct=0c3c053300340c3600&kw=case%202" target="_blank" alt="<a href="http://cityadspix.com/tsclick-GQBE4OE0-JHFDQUHP?url=http%3A%2F%2Fogo1.ru%2Fmarket%2Fsumki_dlya_noutbukov%2F56549-10-amp-quot-Sumka-Targus-TSS112EU-Blue&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&bt=20&pt=9&lt=2&tl=3&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&im=OTY1NS0wLTE0MTc3ODE0NTItMTg0ODkyNjE%3D&fid=NDQ1NzU2Nzc1&prdct=0c3c053300340c3600&kw=Targus%20Crave%20Netbook%20Case%2010.2" target="_blank" alt="Targus Crave Netbook Case 10.2" title="Targus Crave Netbook Case 10.2" style="">Targus Crave Netbook Case 10.2</a>" title="Targus Crave Netbook Case 10.2" style="">case 2</a>: 

new 
string[24]; 
format(string,sizeof(string),"Go-Kart Derby!"); 
GameTextForPlayer(playeridstring,5000,3); 
SetPlayerPos(playerid2311.6377,2188.6648,103.8786); 
SetPlayerInterior(playerid0); 
SetPlayerVirtualWorld(playerid501); // virtual world event 2 
SetPlayerArmedWeapon(playerid,0); // fists
RemovePlayerAttachedObject(playerid, -1); 
SendClientMessage(playeridLIME"You have Joined the Go-Kart Derby, get inside a Vehicle and Wait for Further Instructions!"); 

<
a href="http://cityadspix.com/tsclick-MIQCWPUV-GECAQBFF?url=http%3A%2F%2Fwww.sotmarket.ru%2Fproduct%2Fsumka-hp-professional-h4j94aa-notebook-17-3.html&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&bt=20&pt=9&lt=2&tl=3&im=ODI1LTAtMTQxNzc4MTM4My0xMTU1OTMyMg%3D%3D&fid=NDQ1NzU2Nzc1&prdct=3c0a3d023605&kw=case%203" target="_blank" alt="HP Professional Leather <a href="http://cityadspix.com/tsclick-MIQCWPUV-GECAQBFF?url=http%3A%2F%2Fwww.sotmarket.ru%2Fproduct%2Fsumka-notebook-15-targus-cn-514-eu-50.html&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&bt=20&pt=9&lt=2&tl=3&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&im=ODI1LTAtMTQxNzc4MTM4My0xODM4NTY3OA%3D%3D&fid=NDQ1NzU2Nzc1&prdct=390931073505&kw=Case%2017.3" target="_blank" alt="<a href="http://cityadspix.com/tsclick-MIQCWPUV-GECAQBFF?url=http%3A%2F%2Fwww.sotmarket.ru%2Fproduct%2Fsumka-notebook-15-targus-cn-514-eu-50.html&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&bt=20&pt=9&lt=2&tl=3&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&im=ODI1LTAtMTQxNzc4MTQ1Mi0xMjMxMzgxMw%3D%3D&fid=NDQ1NzU2Nzc1&prdct=390931073505&kw=Targus%20Classic%2B%20Toploading%20Case%2013-14.1" target="_blank" alt="Targus Classic+ <a href="http://cityadspix.com/tsclick-MIQCWPUV-GECAQBFF?url=http%3A%2F%2Fwww.sotmarket.ru%2Fproduct%2Fsumka-notebook-15-targus-cn-514-eu-50.html&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&bt=20&pt=9&lt=2&tl=3&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&im=ODI1LTAtMTQxNzc4MTQ1Mi0xNzk5MjQzNg%3D%3D&fid=NDQ1NzU2Nzc1&prdct=390931073505&kw=Toploading%20Case%2013-14.1" target="_blank" alt="Targus Classic+ Toploading <a href="http://cityadspix.com/tsclick-MIQCWPUV-GECAQBFF?url=http%3A%2F%2Fwww.sotmarket.ru%2Fproduct%2Fsumka-notebook-15-targus-cn-514-eu-50.html&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&bt=20&pt=9&lt=2&tl=3&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&im=ODI1LTAtMTQxNzc4MTQ1My0xODkzNTg5OQ%3D%3D&fid=NDQ1NzU2Nzc1&prdct=390931073505&kw=Case%2013-14.1" target="_blank" alt="Targus Classic+ Toploading Case 13-14.1" title="Targus Classic+ Toploading Case 13-14.1" style="">Case 13-14.1</a>" title="Targus Classic+ Toploading Case 13-14.1" style="">Toploading Case 13-14.1</a>" title="Targus Classic+ Toploading Case 13-14.1" style="">Targus Classic+ Toploading Case 13-14.1</a>" title="Targus Classic+ Toploading Case 13-14.1" style="">Case 17.3</a>" title="<a href="http://cityadspix.com/tsclick-MIQCWPUV-GECAQBFF?url=http%3A%2F%2Fwww.sotmarket.ru%2Fproduct%2Fsumka-hp-professional-h4j94aa-notebook-17-3.html&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&bt=20&pt=9&lt=2&tl=3&im=ODI1LTAtMTQxNzc4MTQ1Mi0xODcxMTI0NA%3D%3D&fid=NDQ1NzU2Nzc1&prdct=3c0a3d023605&kw=HP%20Professional%20Leather%20Case%2017.3" target="_blank" alt="<a href="http://cityadspix.com/tsclick-MIQCWPUV-GECAQBFF?url=http%3A%2F%2Fwww.sotmarket.ru%2Fproduct%2Fsumka-hp-professional-h4j94aa-notebook-17-3.html&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&bt=20&pt=9&lt=2&tl=3&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&im=ODI1LTAtMTQxNzc4MTQ1Mi0xNjA2NjgyMg%3D%3D&fid=NDQ1NzU2Nzc1&prdct=3c0a3d023605&kw=HP%20Professional%20Leather" target="_blank" alt="HP Professional Leather Case 17.3" title="HP Professional Leather Case 17.3" style="">HP Professional Leather</a> Case 17.3" title="HP Professional Leather Case 17.3" style="">HP Professional Leather Case 17.3</a>" style="">case 3</a>: 

new 
string[24]; 
format(string,sizeof(string),"Sand King Derby!"); 
GameTextForPlayer(playeridstring,5000,3); 
SetPlayerPos(playerid2311.6377,2188.6648,103.8786); 
SetPlayerInterior(playerid0); 
SetPlayerVirtualWorld(playerid502); // virtual world event 3 
SetPlayerArmedWeapon(playerid,0); // fists
RemovePlayerAttachedObject(playerid, -1); 
SendClientMessage(playeridLIME"You have Joined the Sand King Derby, get inside a Vehicle and Wait for Further Instructions!"); 


return 
1

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)