Raised This Month: $ Target: $400
 0% 

Confused.....


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zenith77
Veteran Member
Join Date: Aug 2005
Old 08-23-2005 , 19:50   Confused.....
Reply With Quote #1

Okay i cant figure out why its giving me the errors below...

ok this plugin allows you to pickpockets someone......

Code:
#include <amxmodx> #include <cstrike> public plugin_init() {     register_plugin( "PickPocket", "1.0", "Zenith77" )     register_clcmd( "amx_pickpocket", "pickpocket", ADMIN_ALL, "Pickpockets the person near you!" )     register_cvar( "pp_ppradius", "10" ) }   register_cvar( "pp_pickamount", "1000" ) public pickpocket(id) {     new pockter_origin[3]     new victim_origin[3]         new pp_radius = get_cvar_num("pp_ppradius")             new max_players[32]     new players_num[32]     new players[32]             max_players = get_players(players, players_num, "a") // we use this for the for loop!         for( new i = 0; i< max_players; i++){         if( is_user_alive(id) && get_user_team(id) != get_user_team(i) ) { // prevents pick pocketing from you own team....             get_user_origin(id, pockter_origin)             get_user_origin(i, victim_origin)                         new distance = get_distance( pocketer_origin, victim_origin )                         if( distance <= pp_radius ) {                 get_user_money(id)                 get_user_money(i)                 // the above is just so it can "refernce" it                                 //[][][][][][][][][][][][][][][][][][][]                 // the below checks if the victim has no money or if                 // the pick pocketer has 16000 dollars..if so action is cancled!                 if(get_user_money(i) == 0) {                     client_print(id, print_chat, "[AMXX] He has no money for you to take! Go search for someone else!" )                     return PLUGIN_HANDLED                 }                 if(get_user_money(id) == 16000){                     client_print(id, print_chat, "[AMXX] Ok now your just being greedy, pick pocketing is only for needy people! :P" )                     return PLUGIN_HANDLED                 }                 //[][][][][][][][][][][][][][][][][][][][]                                                 new amount = get_cvar_num("pp_pickamount")                 new result                 new p_amount // pick pocketer amount of money                 new v_amount // victim amount of money                                 p_amount = get_user_money(id)                 v_amount = get_user_money(i)                 if(get_cvar_num("pp_pickamount") > v_amount) {                     new result2                                         // If you will noitce below this one is "equation" is different from the                     // one in the code below...this prevents negative numbers and                     // makes sure that if the vitim has less money than the pp_pickamount cvar                     //it prevents the pickpocketer from getting all the money....                                         result2 = amount - v_amount                                         new amount_pp = p_amount + result2                     set_user_money(i, 0, 1)                     set_user_money(id, amount_new, 1)                                         client_print(i, print_chat, "[AMXX] OH NO! You've been pick pocketed!")                     client_print(id, print_chat, "[AMXX] Congrats on your successful Pick! You never cease to amaze me ;)" )                                         return PLUGIN_HANDLED                 }                                 if(get_cvar_num("pp_pickamount") < v_amount) {                                         result = v_amount - amount                                         new amount_pp = p_amount + result                                         set_user_money(i, result, 1)                     set_user_money(id, amount_pp, 1)                                         client_print(i, print_chat, "[AMXX] OH NO! You've been pick pocketed!")                     client_print(id, print_chat, "[AMXX] Congrats on your successful Pick! You never cease to amaze me ;)" )                                         return PLUGIN_HANDLED                 }             }         }     }     return PLUGIN_HANDLED }
Attached Thumbnails
Click image for larger version

Name:	erros.gif
Views:	103
Size:	17.3 KB
ID:	3711  
Zenith77 is offline
DahVid
Senior Member
Join Date: Jun 2005
Old 08-23-2005 , 19:58  
Reply With Quote #2

Too lazy to really look, but for the first one..

Code:
}    register_cvar( "pp_pickamount", "1000" )
Put the } below register_cvar.
DahVid is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 08-23-2005 , 20:00  
Reply With Quote #3

zomg....

but thnx ...

what about the array :/
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
DahVid
Senior Member
Join Date: Jun 2005
Old 08-23-2005 , 20:05  
Reply With Quote #4

I'm not too familiar with putting arrays on shit, I think you'd add like an [id] or [something] Anyways, I'd just use

for (i = 1; i < 33; i++)

instead of getting maxplayers.
DahVid is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 08-23-2005 , 20:08  
Reply With Quote #5

but then it would simply execute the code 32 times..no matter how many players are there....
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 08-23-2005 , 20:59  
Reply With Quote #6

Quote:
Originally Posted by DahVid
I'm not too familiar with putting arrays on shit, I think you'd add like an [id] or [something] Anyways, I'd just use

for (i = 1; i < 33; i++)

instead of getting maxplayers.
Bad advice.

What errors are you getting? You mentioned that you were getting them but I don't see where you indicate what they are.
Brad is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 08-23-2005 , 21:20  
Reply With Quote #7

look at teh errors.gif :/


it keeps saying array must be indexed...
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
DahVid
Senior Member
Join Date: Jun 2005
Old 08-23-2005 , 21:24  
Reply With Quote #8

Code:
#include <amxmodx> #include <cstrike> public plugin_init() {     register_plugin( "PickPocket", "1.0", "Zenith77" )     register_clcmd( "amx_pickpocket", "pickpocket", ADMIN_ALL, "Pickpockets the person near you!" )     register_cvar( "pp_ppradius", "10" )     register_cvar( "pp_pickamount", "1000" ) } public pickpocket(id) {     new pockter_origin[3]     new victim_origin[3]     new pp_radius = get_cvar_num("pp_ppradius")     new max_players[32]     new players_num     new players[32]         max_players[5] = get_players(players, players_num, "a") // we use this for the for loop!         for( new i = 0; i< max_players[5]; i++){         if( is_user_alive(id) && get_user_team(id) != get_user_team(i) ) { // prevents pick pocketing from you own team....                 get_user_origin(id, pockter_origin)             get_user_origin(i, victim_origin)                         new distance = get_distance( pockter_origin, victim_origin )                         if( distance <= pp_radius ) {                 cs_get_user_money(id)                 cs_get_user_money(i)                 // the above is just so it can "refernce" it                                 //[][][][][][][][][][][][][][][][][][][]                 // the below checks if the victim has no money or if                 // the pick pocketer has 16000 dollars..if so action is cancled!                 if(cs_get_user_money(i) == 0) {                     client_print(id, print_chat, "[AMXX] He has no money for you to take! Go search for someone else!" )                     return PLUGIN_HANDLED                 }                 if(cs_get_user_money(id) == 16000){                     client_print(id, print_chat, "[AMXX] Ok now your just being greedy, pick pocketing is only for needy people! Razz" )                     return PLUGIN_HANDLED                 }                 //[][][][][][][][][][][][][][][][][][][][]                                                 new amount = get_cvar_num("pp_pickamount")                 new result                 new p_amount // pick pocketer amount of money                 new v_amount // victim amount of money                                 p_amount = cs_get_user_money(id)                 v_amount = cs_get_user_money(i)                 if(get_cvar_num("pp_pickamount") > v_amount) {                     new result2                                         // If you will noitce below this one is "equation" is different from the                     // one in the code below...this prevents negative numbers and                     // makes sure that if the vitim has less money than the pp_pickamount cvar                     //it prevents the pickpocketer from getting all the money....                                         result2 = amount - v_amount                                         new amount_pp = p_amount + result2                     cs_set_user_money(i, 0, 1)                     cs_set_user_money(id, amount_pp, 1)                                         client_print(i, print_chat, "[AMXX] OH NO! You've been pick pocketed!")                     client_print(id, print_chat, "[AMXX] Congrats on your successful Pick! You never cease to amaze me Wink" )                                         return PLUGIN_HANDLED                 }                                 if(get_cvar_num("pp_pickamount") < v_amount) {                                         result = v_amount - amount                                         new amount_pp = p_amount + result                                         cs_set_user_money(i, result, 1)                     cs_set_user_money(id, amount_pp, 1)                                         client_print(i, print_chat, "[AMXX] OH NO! You've been pick pocketed!")                     client_print(id, print_chat, "[AMXX] Congrats on your successful Pick! You never cease to amaze me Wink" )                                         return PLUGIN_HANDLED                 }             }         }     }     return PLUGIN_HANDLED }

IDK, just a try.
DahVid is offline
DahVid
Senior Member
Join Date: Jun 2005
Old 08-23-2005 , 21:27  
Reply With Quote #9

Errors:
An index is [x] so I put [5] for the len I guess.

players_num shouldn't have an index.

You mispelled pockter_origin

You used get_user_money/set_user_money, that's a amxmod.inc native (Conversion)

cs_get_user_money/cs_set_user_money

amount_new?? That's not a variable I think you wanted amount_pp
DahVid is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 08-23-2005 , 21:29  
Reply With Quote #10

ok thnx..i see...

amount_new is that one if statement...where the amount to take is greater than the users money...


i will fix everything up..i will post back with update...
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 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 14:35.


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