AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Prokreedz help (https://forums.alliedmods.net/showthread.php?t=49984)

aDr. 01-17-2007 03:27

Prokreedz help
 
1 Attachment(s)
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.

Salepate 01-17-2007 07:06

Re: Prokreedz help
 
check if velocity z does not contain a negative value ?

aDr. 01-17-2007 07:38

Re: Prokreedz help
 
Quote:

Originally Posted by Salepate (Post 428327)
check if velocity z does not contain a negative value ?

how?

Salepate 01-17-2007 08:00

Re: Prokreedz help
 
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 !

aDr. 01-17-2007 09:34

Re: Prokreedz help
 
Please give me the .sma , because i dont know where to put these codes :| , i am a noob in amxx scripting :cry: . 10x thanx

Bad_Bud 01-17-2007 10:08

Re: Prokreedz help
 
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



aDr. 01-17-2007 10:16

Re: Prokreedz help
 
Thank you very , very much , i dont know where to put these code :cry: , please give me the .sma file

Bad_Bud 01-17-2007 10:20

Re: Prokreedz help
 
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.

aDr. 01-17-2007 10:30

Re: Prokreedz help
 
1 Attachment(s)
[IMG]http://http://img225.**************/img225/7282/prokzkl9.jpg[/IMG]
Quote:

Originally Posted by Bad_Bud (Post 428388)
Just look for that function and paste over it with the new one in that code box.

I do that but :cry: 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(258) : error 029: invalid expression, assumed zero
/home/groups/alliedmodders/forums/files/2/1/5/0/3/13322.attach(258) : warning 221: label name "Float" shadows tag name
/home/groups/alliedmodders/forums/files/2/1/5/0/3/13322.attach(258) : error 017: undefined symbol "origin"
/home/groups/alliedmodders/forums/files/2/1/5/0/3/13322.attach(258) : warning 215: expression has no effect
/home/groups/alliedmodders/forums/files/2/1/5/0/3/13322.attach(258) : error 001: expected token: ";", but found "]"
/home/groups/alliedmodders/forums/files/2/1/5/0/3/13322.attach(258) : fatal error 107: too many error messages on one line

Compilation aborted.
4 Errors.

[IMG]http://http://img225.**************/img225/7282/prokzkl9.jpg[/IMG]

Bad_Bud 01-17-2007 10:45

Re: Prokreedz help
 
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




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

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