AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   I dont think this array is...declaring? (https://forums.alliedmods.net/showthread.php?t=9007)

TotalNoobScripter 01-03-2005 00:09

I dont think this array is...declaring?
 
*This is basically a rip of avanchles code, I am only posting the code that applies to the problem.

Code:
#include <amxmodx>  #include <amxmisc>  #include <engine>  #define MAXDOORS 999 // max amount of doors  new elecdoorX[3] = (2559, 2559, 2559)  new elecdoorY[3] = (-2119, -2119, -2119)  new elecdoorZ[3] = (-172, -172, -172)    new doorislocked[MAXDOORS]; // if door is locked  new doorhaskey[33][MAXDOORS]; // if player has key for door  new hackingstage[33]  new doorbuttonid[MAXDOORS]; // id of button entity for door (if it has one)  new doorbuttontarget[MAXDOORS][64]; // target of button entity for door (if it has one) public hackdoor(id) {     new doorid, buttonid, buttonbody, isbutton;   get_user_aiming(id,buttonid,buttonbody,9999);   new origin[3], checkorigin[3], validpos;    get_user_origin(id,origin,3);    for(new i=0;i<sizeof(elecdoorX);i++) {     checkorigin[0] = elecdoorX[i];     checkorigin[1] = elecdoorY[i];     checkorigin[2] = elecdoorZ[i];     if(get_distance(origin,checkorigin) <= 30) {      validpos = 1;     }    }   if (validpos != 1) {       client_print(id,print_chat,"* [-Snort-] You are not near a door's electronic system.");       return PLUGIN_HANDLED   }     if(is_valid_ent(buttonid)) { // if valid ent    isbutton = is_button(buttonid);   }   else { // if invalid ent    client_print(id,print_chat,"* [-Snort-] You can only hack doors that use electronic devices");    return PLUGIN_HANDLED;   }   if(isbutton == 0) { // if not a button entity    client_print(id,print_chat,"* [-Snort-] Hack the electronic system, not the door itself.");    return PLUGIN_HANDLED;   }   // go through doors   for(new i=0;i<MAXDOORS;i++) {    if(doorbuttonid[i] == buttonid) { // if this button belongs to this door      doorid = i; // let us know      break;    }   }   // if no doors found   if(doorid == 0 || !is_valid_ent(doorid)) {    client_print(id,print_chat,"* [-Snort-] No locked doors belong to this button");    return PLUGIN_HANDLED;   }   if(doorid > MAXDOORS-1) { // if exceeds our array    client_print(id,print_chat,"* [-Snort-] ERROR: Too many entities");    return PLUGIN_HANDLED;   }   // if door is unlocked   if(doorislocked[doorid] == 0) {    client_print(id,print_chat,"* [-Snort-] This door does not require opening");    return PLUGIN_HANDLED;   }  client_print(id,print_chat,"* [-Snort-] You have begun hacking.")   hackingstage[id] = 1   starthackmode(id)       return PLUGIN_HANDLED;  }            public starthackmode(id) {  new doorid, buttonid, buttonbody, isbutton;   get_user_aiming(id,buttonid,buttonbody,9999);   if(is_valid_ent(buttonid)) { // if valid ent    isbutton = is_button(buttonid);   }   else { // if invalid ent    client_print(id,print_chat,"* [-Snort-] You moved away and are no longer hacking.");    client_print(id,print_chat,"* [-Snort-] You throw the laptop away to get rid of evidence.");    hackingstage[id] = 0    return PLUGIN_HANDLED;   }   if(isbutton == 0) { // if not a button entity    client_print(id,print_chat,"* [-Snort-] You moved away and are no longer hacking.");    client_print(id,print_chat,"* [-Snort-] You throw the laptop away to get rid of evidence.");    hackingstage[id] = 0    return PLUGIN_HANDLED;   }   // go through doors   for(new i=0;i<MAXDOORS;i++) {    if(doorbuttonid[i] == buttonid) { // if this button belongs to this door      doorid = i; // let us know      break;    }   }   // if no doors found   if(doorid == 0 || !is_valid_ent(doorid)) {    client_print(id,print_chat,"* [-Snort-] You moved away and are no longer hacking.");    client_print(id,print_chat,"* [-Snort-] You throw the laptop away to get rid of evidence.");    hackingstage[id] = 0    return PLUGIN_HANDLED;   }   if(doorid > MAXDOORS-1) { // if exceeds our array    client_print(id,print_chat,"* [-Snort-] You moved away and are no longer hacking.");    client_print(id,print_chat,"* [-Snort-] You throw the laptop away to get rid of evidence.");    hackingstage[id] = 0    return PLUGIN_HANDLED; }       if ( (hackingstage[id] < 1 ) && ( hackingstage[id] != 10 ) ) {     new percentdone     percentdone = hackingstage[id] * 10       client_print(id,print_chat,"* [-Snort-] You are %s^% done hacking.",percentdone);       hackingstage[id] = hackingstage[id] + 1        set_task(3.0,"showhacklevel",id);       return PLUGIN_HANDLED     }     if (hackingstage[id] == 10) {         client_print(id,print_chat,"* [-Snort-] Hacking Successful.");         client_print(id,print_chat,"* [-Snort-] Your laptop has been traced.");         client_print(id,print_chat,"* [-Snort-] The local authorities have been warned.");         //warnmcpd(id)         hackingstage[id] = 0;         force_use(id,doorid);         return PLUGIN_HANDLED   }   client_print(id,print_chat,"* [-Snort-]hackingstage[id] = %s",hackingstage[id]);   return PLUGIN_HANDLED }

As you can see, i even made a client_print that shows the hackingstage[id], but ingame it looks like
* [Snort] hackingstage[id] =
just... blank.

Can anyone see the problem?

*Also, btw, avalanche i only put the [-Snort-] in the chat of the hacking messages, not any of the [door] stuff. Just like to reference that.*

XxAvalanchexX 01-03-2005 00:15

a) You had better leave my name in the plugin_init

b) You check for the following: hackingstage[id] < 1. Why? This is checking if they are less than 10% done, so I'm not sure what this is for, since the actions of the if statement seem to be pretty important.

c) You attempt to display an integer value with %s. %d is integers, %f is floats, %s is strings, and I believe there are more.

EDIT: d) Why does everyone still have my code lying around?!

TotalNoobScripter 01-03-2005 18:48

a) of course i left your name in the plugin init. I just removed the echo when the server loads becuz for somereason my hlsw wont connect to a server when it echos upon boot up... no clue why but yea. Instead i made a /credits motd.

< 1 .... DOH talk about an uber typo.

wel%s and %i and all the others... there should be a %lol to show my stupidity.

No one will ever delete your code, its too good.

edit: just read your sig. Tell an admin to delete your plugin out of the trash section of the fourm.

Twilight Suzuka 01-03-2005 20:47

Its because lots of people used it, and theres really nothing else, for now anyway,


All times are GMT -4. The time now is 19:28.

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