SA-MP Forums

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

 
 
Thread Tools Display Modes
Old 06/03/2010, 09:47 PM   #1
Puzi
Huge Clucker
 
Join Date: Mar 2009
Posts: 325
Reputation: 0
Default Givecash bug

Hello, I face a problem.
Any command I type that isnt in my script returns with USAGE: /givecash [playerid] message instead SERVER: Unknown Command message. Any ideas why does that happen?
Puzi is offline  
Old 06/03/2010, 10:14 PM   #2
Pawel2k9
Little Clucker
 
Join Date: Sep 2009
Posts: 40
Reputation: 0
Default Re: Givecash bug

post the full code for
pawn Code:
public OnPlayerCommandText
here:
Pawel2k9 is offline  
Old 06/03/2010, 10:16 PM   #3
Puzi
Huge Clucker
 
Join Date: Mar 2009
Posts: 325
Reputation: 0
Default Re: Givecash bug

Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
Commands begin...

Code:
if(strcmp(cmd, "/givecash", true) == 0) {
	  new tmp[256];
		tmp = strtok(cmdtext, idx);

		if(!strlen(tmp)) {
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
			return 1;
		}
		giveplayerid = strval(tmp);

		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp)) {
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
			return 1;
		}
 		moneys = strval(tmp);

		printf("givecash_command: %d %d",giveplayerid,moneys);


		if (IsPlayerConnected(giveplayerid)) {
			GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
			GetPlayerName(playerid, sendername, sizeof(sendername));
			playermoney = GetPlayerMoney(playerid);
			if (moneys > 0 && playermoney >= moneys) {
				GivePlayerMoney(playerid, (0 - moneys));
				GivePlayerMoney(giveplayerid, moneys);
				format(stringa, sizeof(stringa), "You have sent %s (player: %d), $%d.", giveplayer,giveplayerid, moneys);
				SendClientMessage(playerid, COLOR_YELLOW, stringa);
				format(stringa, sizeof(stringa), "You have received $%d from %s (player: %d).", moneys, sendername, playerid);
				SendClientMessage(giveplayerid, COLOR_YELLOW, stringa);
				printf("%s(playerid:%d) wysłał %d do %s(playerid:%d)",sendername, playerid, moneys, giveplayer, giveplayerid);
			}
			else {
				SendClientMessage(playerid, COLOR_YELLOW, "Incorrect amount.");
			}
		}
		else {
				format(stringa, sizeof(stringa), "%d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_YELLOW, stringa);
			}
		return 1;
	}
Puzi is offline  
Old 06/03/2010, 10:21 PM   #4
Pawel2k9
Little Clucker
 
Join Date: Sep 2009
Posts: 40
Reputation: 0
Default Re: Givecash bug

no i mean all of it from public to return 0; }
Pawel2k9 is offline  
Old 06/03/2010, 10:26 PM   #5
Puzi
Huge Clucker
 
Join Date: Mar 2009
Posts: 325
Reputation: 0
Default Re: Givecash bug

Isnt there too much of it?
Puzi is offline  
Old 07/03/2010, 01:23 AM   #6
Correlli
Godfather
 
Correlli's Avatar
 
Join Date: May 2009
Location: Slovenia
Posts: 6,340
Reputation: 365
Default Re: Givecash bug

Quote:
Originally Posted by Puzi
Hello, I face a problem.
Any command I type that isnt in my script returns with USAGE: /givecash [playerid] message instead SERVER: Unknown Command message. Any ideas why does that happen?
Make sure that you haven't messed any bracket at OnPlayerCommandText callback.
Correlli is offline  
 

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
/givecash 02manchestera Help Archive 3 14/03/2010 02:51 PM
givecash Lajko1 Help Archive 6 09/10/2009 10:06 PM
PLease help with /givecash Scoots Help Archive 28 27/03/2009 11:42 AM
givecash CJ101 Help Archive 1 19/02/2009 02:05 PM
/givecash amrour Help Archive 5 15/02/2009 03:55 PM


All times are GMT. The time now is 08:58 AM.


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