SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Thread Tools Display Modes
Old 22/05/2019, 05:01 PM   #1
Huge Clucker
Join Date: Aug 2018
Posts: 293
Reputation: 0
Default Command Problem

hi i was tried to create a command for checking player stats like his money , score and other stuffs , i tried to create this as a dialog , but i get this error when i try to use the command:
[21:21:54] [debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[21:21:54] [debug]  Stack pointer (STK) is 0x38573DC, heap pointer (HEA) is 0x3857458
[21:21:54] [debug] AMX backtrace:
[21:21:54] [debug] #0 0019550c in public ac_OnPlayerCommandText (7, 59077680) in rpgm.amx
[21:21:54] [debug] #1 000226c0 in public OnPlayerCommandText (7, 59077680) in rpgm.amx
i thought its my ralated to my command content (format variables and this works) so i remove them and tried to recompile and test the command in game again , but get same error whats wrong? here is my code :
	new Cont[1024];
	new Title[128],string[128],ID,Money_Bank[128],Money[128],Money_House[128],Money_Kol[128],hr,mn,sec,KolPol,WeaponSkill[128],
	if(sscanf(params, "u", ID ))
		SendClientMessage(playerid,COLOR_ERROR,"USAGE: /checkplayerstats (ID)");
		return 1;
	ShowPlayerDialog(playerid, DIALOG_PLAYERCHECK, DIALOG_STYLE_MSGBOX, Title, Cont, "Ok", "");
	return 1;
PoniStar is offline   Reply With Quote
Old 22/05/2019, 05:34 PM   #2
TheToretto's Avatar
Join Date: Jul 2015
Posts: 584
Reputation: 66
Default Re: Command Problem

Holy cow how many unused variables are there? you can do it all in one variable, some if statements + 1 single format and return it or send it to the user or idk what you're trying to do


Rest in peace grandpa, 03 November 2018
TheToretto is offline   Reply With Quote
Old 22/05/2019, 07:31 PM   #3
Huge Clucker
Join Date: Aug 2018
Posts: 293
Reputation: 0
Default Re: Command Problem

They are not used ! I just removed some lines to check is the problem with them and its show error even without them , for exp i use them like this:
if(PlayerDeathes[ID] != 0) format(pDeath,128,"Deathes: %d",PlayerDeathes[ID]);
else pDeath = "{ff0000}Deathes: 0 - cl";
.... (and like this for other var's)
And in the end attach them to a single string :
format(Cont,sizeof(Count),"%s\n%s\n%s\n ...",pDeath,pKills,...); and use that on dialog but get that error
PoniStar is offline   Reply With Quote
Old 22/05/2019, 07:42 PM   #4
Symon's Avatar
Join Date: Apr 2019
Location: Italy
Posts: 923
Reputation: 89
Default Re: Command Problem

That's not how you create a stats command. Im wondering HOW your server isn't exploded yet with all that mess.

First, use en enum:

pawn Code:
enum pInfo

new PlayerData[MAX_PLAYERS][pInfo];

To add player kills:

pawn Code:
Player[playerid][Kills] ++

To read it:

pawn Code:
format(string, sizeof(string), "%d kills", Player[playerid][Kills]);

To save it:

pawn Code:

No need to create all that useless (and unused) variables.

Also you should use %d or %i for integers. %s is for strings.
Symon is offline   Reply With Quote

Thread Tools
Display Modes

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with YCMD proces command and problem with "Server:Unknown command JoDe Scripting Help 1 20/04/2018 12:12 PM
Problem with command. Only returns Server: Unknown Command Knappen Scripting Help 9 18/12/2013 06:09 PM
Problem with command , UNKNOWN COMMAND Jony_Cruze Server Support 4 05/01/2013 06:04 AM
Problem with command , UNKNOWN COMMAND Jony_Cruze Scripting Help 29 20/12/2012 03:17 PM
Command problem(gate command) pliptm Help Archive 0 01/06/2011 05:35 PM

All times are GMT. The time now is 10:42 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.