AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Fixing errors (https://forums.alliedmods.net/showthread.php?t=85737)

mazmaajinsh 02-15-2009 08:28

Fixing errors
 
Hello. Could somene say to me, whats wrong with this part of the code?
Code:
public checkpoint(id) {     if(get_pcvar_num(kz_checkpoints) == 1) {         if(is_user_alive(id)) {                         if(entity_get_int(id,EV_INT_flags)&FL_ONGROUND) {                     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,"[TJ] 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))                 set_hudmessage(id, 138, 232, 0.03, 0.5, 0, 6.0, 3.0)                 show_hudmessage(id, "Checkpoint nr. %d created",checkpointnum[id-1]+1)                 } else {                 set_hudmessage(id, 138, 232, 0.03, 0.5, 0, 6.0, 3.0)                 show_hudmessage(id, "Checkpoint nr. 1 created")             }             checkpointnum[id-1]++             } else {             set_hudmessage(id, 138, 232, 0.03, 0.5, 0, 6.0, 3.0)             show_hudmessage(id, "You must be alive")         }         } else {         set_hudmessage(id, 138, 232, 0.03, 0.5, 0, 6.0, 3.0)         show_hudmessage(id, "Checkpoints are disabled")     }         return PLUGIN_HANDLED }

It gives a lot of loose identitation and undefined symbol in the other parts or the plugin, but if i remove this part, it doesnt.

Starsailor 02-15-2009 09:58

Re: Fixing errors
 
for loose indentation use ctrl + i :D

xPaw 02-15-2009 11:14

Re: Fixing errors
 
PHP Code:

public checkpointid ) {
    if(
get_pcvar_num(kz_checkpoints) == 1) {
        if(
is_user_alive(id)) {
            if(
entity_get_int(id,EV_INT_flags) & FL_ONGROUND) {    
                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,"[TJ] 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))
                    
set_hudmessage(id1382320.030.506.03.0)
                    
show_hudmessage(id"Checkpoint nr. %d created",checkpointnum[id-1]+1)
                } else {
                    
set_hudmessage(id1382320.030.506.03.0)
                    
show_hudmessage(id"Checkpoint nr. 1 created")
                }
                
checkpointnum[id-1]++
        } else {
            
set_hudmessage(id1382320.030.506.03.0)
            
show_hudmessage(id"You must be alive")
        }
    } else {
        
set_hudmessage(id1382320.030.506.03.0)
        
show_hudmessage(id"Checkpoints are disabled")
    }

    return 
PLUGIN_HANDLED;


...

mazmaajinsh 02-15-2009 11:26

Re: Fixing errors
 
Thanks for helping guys :)


All times are GMT -4. The time now is 16:58.

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