Raised This Month: $ Target: $400
 0% 

Prokreedz help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
aDr.
Member
Join Date: Oct 2006
Old 01-17-2007 , 03:27   Prokreedz help
Reply With Quote #1

How to make prokreedz plugin to dont make checkpoint while falling , and to display a message like "You can`t make checkpoint while falling" , like in this plugin http://forums.alliedmods.net/showthread.php?t=42367 , pls help me.
Attached Files
File Type: sma Get Plugin or Get Source (prokreedz.sma - 877 views - 39.1 KB)
aDr. is offline
Salepate
Junior Member
Join Date: Jan 2007
Old 01-17-2007 , 07:06   Re: Prokreedz help
Reply With Quote #2

check if velocity z does not contain a negative value ?
Salepate is offline
aDr.
Member
Join Date: Oct 2006
Old 01-17-2007 , 07:38   Re: Prokreedz help
Reply With Quote #3

Quote:
Originally Posted by Salepate View Post
check if velocity z does not contain a negative value ?
how?
aDr. is offline
Salepate
Junior Member
Join Date: Jan 2007
Old 01-17-2007 , 08:00   Re: Prokreedz help
Reply With Quote #4

You should try this :
Code:
public func(id) {     new Float _velocity[3];     entity_get_vector(id, EV_VEC_velocity, p_velocity)     if ( p_velocity[2] < 0.0 ) {         client_print(id, print_chat, "[AMXX] You can't make checkpoint while falling");         return PLUGIN_HANDLED;     }     // Else the player is just standing or Jumping }
But this not very advanced, because if a player is just going downstair or something like that it can handle because Z-velocity goes under 0

In my opinion it should be enough for you that's it !
Salepate is offline
aDr.
Member
Join Date: Oct 2006
Old 01-17-2007 , 09:34   Re: Prokreedz help
Reply With Quote #5

Please give me the .sma , because i dont know where to put these codes , i am a noob in amxx scripting . 10x thanx
aDr. is offline
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 01-17-2007 , 10:08   Re: Prokreedz help
Reply With Quote #6

I added a velocity check into your existing function, so you can just copy and paste over what you already have.

What this does: gets the player's velocity vector, and checks the Z value for vertical motion(X is 0, Y is 2, Z is 2). I figured you might want to have it check for if they've jumped as well, because if they can't checkpoint while crouched, I doubt you want them checkpointing while jumping. If their Z velocity is 0, clearly they aren't on the ground. In another way, you could also check to see if FL_ONGROUND is true on a player. If they aren't on ground, clearly something is amuck.

PHP Code:
public checkpoint(id) {
 if(
get_pcvar_num(kz_checkpoints) == 1) {
  if(
is_user_alive(id)) {
   new 
Float:velocity[3]
   
entity_get_vector(id,EV_VEC_velocity,velocity)
   
   
entity_get_vector(id,EV_VEC_origin,new Float:origin[3])
   if(
entity_get_int(id,EV_INT_flags)&FL_DUCKING) {
    
client_print(id,print_chat,"[ProKreedz] You can not create a checkpoint while ducking")
    return 
PLUGIN_HANDLED
   
}
   else if(
velocity[2]!=0)
   {
    
client_print(id,print_chat,"[ProKreedz] You must be on the ground to create a checkpoint")
    return 
PLUGIN_HANDLED
   
}
   
   for(new 
i=MAX_CPS-1;i>0;i--) {
    
checkpoints[id-1][i][0] = checkpoints[id-1][i-1][0]
    
checkpoints[id-1][i][1] = checkpoints[id-1][i-1][1]
    
checkpoints[id-1][i][2] = checkpoints[id-1][i-1][2]
   }
   new 
Float:origin[3]
   
entity_get_vector(id,EV_VEC_origin,origin)
   
checkpoints[id-1][0][0] = origin[0]
   
checkpoints[id-1][0][1] = origin[1]
   
checkpoints[id-1][0][2] = origin[2]
   
   if(
checkpointnum[id-1] > 0)
    
client_print(id,print_chat,"[ProKreedz] Checkpoint no. %d created, distance to the previous one: %dm",checkpointnum[id-1]+1,floatround(get_distance_f(checkpoints[id-1][1],origin) / 20,floatround_round))
   else
    
client_print(id,print_chat,"[ProKreedz] First checkpoint created")
   
checkpointnum[id-1]++
  }
  else
   
client_print(id,print_chat,"[ProKreedz] You have to be alive to use this function")
 }
 else
  
client_print(id,print_chat,"[ProKreedz] Checkpoints are disabled")
 
 return 
PLUGIN_HANDLED

__________________
Bad_Bud is offline
aDr.
Member
Join Date: Oct 2006
Old 01-17-2007 , 10:16   Re: Prokreedz help
Reply With Quote #7

Thank you very , very much , i dont know where to put these code , please give me the .sma file
aDr. is offline
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 01-17-2007 , 10:20   Re: Prokreedz help
Reply With Quote #8

I just told you, I took that from YOUR .sma file. Just look for that function and paste over it with the new one in that code box.
__________________
Bad_Bud is offline
aDr.
Member
Join Date: Oct 2006
Old 01-17-2007 , 10:30   Re: Prokreedz help
Reply With Quote #9

[IMG]http://http://img225.**************/img225/7282/prokzkl9.jpg[/IMG]
Quote:
Originally Posted by Bad_Bud View Post
Just look for that function and paste over it with the new one in that code box.
I do that but look

Plugin failed to compile! Please try contacting the author.Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

/home/groups/alliedmodders/forums/files/2/1/5/0/3/13322.attach(25 : error 029: invalid expression, assumed zero
/home/groups/alliedmodders/forums/files/2/1/5/0/3/13322.attach(25 : warning 221: label name "Float" shadows tag name
/home/groups/alliedmodders/forums/files/2/1/5/0/3/13322.attach(25 : error 017: undefined symbol "origin"
/home/groups/alliedmodders/forums/files/2/1/5/0/3/13322.attach(25 : warning 215: expression has no effect
/home/groups/alliedmodders/forums/files/2/1/5/0/3/13322.attach(25 : error 001: expected token: ";", but found "]"
/home/groups/alliedmodders/forums/files/2/1/5/0/3/13322.attach(25 : fatal error 107: too many error messages on one line

Compilation aborted.
4 Errors.

[IMG]http://http://img225.**************/img225/7282/prokzkl9.jpg[/IMG]
Attached Files
File Type: sma Get Plugin or Get Source (prokreedz.sma - 654 views - 39.4 KB)

Last edited by aDr.; 01-17-2007 at 10:40.
aDr. is offline
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 01-17-2007 , 10:45   Re: Prokreedz help
Reply With Quote #10

Delete the origin line, I don't know how it ended up there... maybe my fault, not sure.

It compiles now, at least.

PHP Code:
public checkpoint(id) {
 if(
get_pcvar_num(kz_checkpoints) == 1) {
  if(
is_user_alive(id)) {
   new 
Float:velocity[3]
   
entity_get_vector(id,EV_VEC_velocity,velocity)
   if(
entity_get_int(id,EV_INT_flags)&FL_DUCKING) {
    
client_print(id,print_chat,"[ProKreedz] You can not create a checkpoint while ducking")
    return 
PLUGIN_HANDLED
   
}
   else if(
velocity[2]!=0)
   {
    
client_print(id,print_chat,"[ProKreedz] You must be on the ground to create a checkpoint")
    return 
PLUGIN_HANDLED
   
}
   
   for(new 
i=MAX_CPS-1;i>0;i--) {
    
checkpoints[id-1][i][0] = checkpoints[id-1][i-1][0]
    
checkpoints[id-1][i][1] = checkpoints[id-1][i-1][1]
    
checkpoints[id-1][i][2] = checkpoints[id-1][i-1][2]
   }
   new 
Float:origin[3]
   
entity_get_vector(id,EV_VEC_origin,origin)
   
checkpoints[id-1][0][0] = origin[0]
   
checkpoints[id-1][0][1] = origin[1]
   
checkpoints[id-1][0][2] = origin[2]
   
   if(
checkpointnum[id-1] > 0)
    
client_print(id,print_chat,"[ProKreedz] Checkpoint no. %d created, distance to the previous one: %dm",checkpointnum[id-1]+1,floatround(get_distance_f(checkpoints[id-1][1],origin) / 20,floatround_round))
   else
    
client_print(id,print_chat,"[ProKreedz] First checkpoint created")
   
checkpointnum[id-1]++
  }
  else
   
client_print(id,print_chat,"[ProKreedz] You have to be alive to use this function")
 }
 else
  
client_print(id,print_chat,"[ProKreedz] Checkpoints are disabled")
 
 return 
PLUGIN_HANDLED

__________________
Bad_Bud is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:21.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode