/pay Help please :)
#1

Hi everyone i got this /pay system here i cant get working i cant see the problem -_-'

Code:
{
	new string[256];
	new playermoney;
	new sendername[MAX_PLAYER_NAME];
	new giveplayer[MAX_PLAYER_NAME];
	new cmd[256];
  new tmp[256], tmp2[256];
	new giveplayerid;
	new idx, moneys;
	GetPlayerName(playerid, playername, sizeof(playername));
	cmd = strtok(cmdtext, idx);

	if(strcmp(cmd, "/pay", true) == 0) {
	  if(!strlen(tmp)) {
			SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /pay [Playerid] [Amount]!");
			return 1;
		}
		giveplayerid = strval(tmp);
		
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp)) {
		  SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /pay [Playerid] [Amount]!");
		  return 1;
		}
		moneys = strval(tmp);
		
		  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(giverplayerid, moneys);
					format(string, sizeof(string), "You Have Given $%d To %s(%d)!", moneys, giveplayer, giveplayerid);
					SendClientMessage(playerid, COLOR_GREEN, string);
					format(string, sizeof(string), "You Recieved $%d From %s(%d)!", moneys, sendername, playerid);
					SendClientMessage(giveplayerid, COLOR_GREEN, string);
					printf("%s(%d) Has Given $%d To %s(%d)", sendername, playerid, moneys, giveplayer, giveplayerid);
				{
		    else
		    }
				  SendClientMessage(playerid, COLOR_RED, "You Dont Have That Amount Of Money!"
			}
			else
			{
			  format(string, sizeof(string), "%d Is Not And Active Player!", giveplayerid);
		  	SendClientMessage(playerid, COLOR_RED, string);
			}
			return 1;
		}
}
i get these error's ..

Code:
C:\Users\------\Desktop\Server ting\SERVER\gamemodes\CS-RP.pwn(501) : warning 217: loose indentation
C:\Users\------\Desktop\Server ting\SERVER\gamemodes\CS-RP.pwn(507) : error 017: undefined symbol "giverplayerid"
C:\Users\------\Desktop\Server ting\SERVER\gamemodes\CS-RP.pwn(513) : warning 217: loose indentation
C:\Users\------\Desktop\Server ting\SERVER\gamemodes\CS-RP.pwn(514) : error 029: invalid expression, assumed zero
C:\Users\------\Desktop\Server ting\SERVER\gamemodes\CS-RP.pwn(516) : warning 217: loose indentation
C:\Users\------\Desktop\Server ting\SERVER\gamemodes\CS-RP.pwn(516 -- 517) : error 001: expected token: ",", but found "}"
C:\Users\------\Desktop\Server ting\SERVER\gamemodes\CS-RP.pwn(518) : warning 217: loose indentation
C:\Users\------\Desktop\Server ting\SERVER\gamemodes\CS-RP.pwn(523) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#2

the indetations errors are because u indented bad, fix it or write up in ur script:

#pragma tabsize 0

should be fixed. And your new giveplayer[MAX_PLAYER_NAME]; shouldn't be:
new giveplayerid[MAX_PLAYER_NAME]; ??

and you missed somes ; at the lines specified, go see

hope i helped

EDIT:
oops i saw your giveplayer is for something else, just add a new giveplayerid[MAX_PLAYER_NAME];
Reply
#3

I'm really new in scripting, but this mistake is really clear mate, I think it causes the trouble too.

C:\Users\------\Desktop\Server ting\SERVER\gamemodes\CS-RP.pwn(507) : error 017: undefined symbol "giverplayerid"

While you defined it as,

new giveplayer[MAX_PLAYER_NAME];
Reply
#4

sorry almighty, but the new giveplayer[MAX_PLAYERS]; is used down in the script, he forgot to add new giveplayerid[MAX_PLAYERS]; that's all xd

and it won't fix all, because loose indentation problems are due to bad indent. not to that.
Reply
#5

Okai Thnx i got that working now..

-EDIT-

But i just figuered a MAJOR problem here.. i havent even noticed it before now..

All GM dont respond to any cmd's /pay /help /rules everthing
it dont say anything ingame if i try use a cmd, or if i compile with pawno..


Pawn Compiler Output:
Code:
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Reply
#6

post in here all your public onplayrcommandtext callback plz. and do you use any filterscripts? maybe you missed a return 0;
Reply
#7

i fixed the problem now, i had a FS who apperently was bugged.. but nvm im gonna fix that one later..

now i want to know one thing why is this now happening

Code:
public OnPlayerConnect(playerid)
{

  new pName[MAX_PLAYER_NAME];
  new string[48];
	new formatZ[256];

	format(formatZ,sizeof(formatZ),"%s.lics.bfx",pName(playerid));
	if(!udb_Exists(formatZ))
	{
	udb_Create(formatZ,"209010");
	}
  gLicenseC[playerid] = dUserINT(formatZ).("carlic");
  gLicenseF[playerid] = dUserINT(formatZ).("fluglic");
  gLicenseB[playerid] = dUserINT(formatZ).("bootlic");
  gLicenseZ[playerid] = dUserINT(formatZ).("bikelic");

	//textdraws
	TextDrawShowForPlayer(playerid, Textdraw1);
	GetPlayerName(playerid, pName, sizeof(pName));
  format(string, sizeof(string), "%s has joined the server.", pName);
  SendClientMessageToAll(0xAAAAAAAA, string);
 	team[playerid] = 0;
  BigEar[playerid] = 0;
	//time();
	SendClientMessage(playerid, COLOR_GREEN, "Welcome West Side Villiage RPG");
	SendClientMessage(playerid, COLOR_YELLOW, "Type /commands to see the commands");
	SendClientMessage(playerid,COLOR_YELLOW,"Please read: /rules and /dmrules");
	SendClientMessage(playerid,COLOR_TOMATO,"Please /login or /register! Thank you, have fun!");

	return 1;
}
Pawno Output
Code:
C:\Users\-----------\Desktop\Serveren\gamemodes\WSV-RPG.pwn(329) : error 012: invalid function call, not a valid address
C:\Users\-----------\Desktop\Serveren\gamemodes\WSV-RPG.pwn(329) : warning 215: expression has no effect
C:\Users\-----------\Desktop\Serveren\gamemodes\WSV-RPG.pwn(329) : error 001: expected token: ";", but found ")"
C:\Users\-----------\Desktop\Serveren\gamemodes\WSV-RPG.pwn(329) : error 029: invalid expression, assumed zero
C:\Users\-----------\Desktop\Serveren\gamemodes\WSV-RPG.pwn(329) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#8

Quote:
Originally Posted by pmk1
sorry almighty, but the new giveplayer[MAX_PLAYERS]; is used down in the script, he forgot to add new giveplayerid[MAX_PLAYERS]; that's all xd

and it won't fix all, because loose indentation problems are due to bad indent. not to that.
Oh yeah didn't notice it.
Reply
#9

xyphozal, can you tell at which line the errors are please? i don't want to search lol
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)