Help on getrefund
#1

Hey guys, i try to make my own command, but i got this error. I don't know how to fix it, i'm newbie only on scripting.

Here's the error.

Код:
C:\Users\aNdRe\Downloads\UnderWorld Roleplay\UnderWorld Roleplay\gamemodes\UWRP16 - Copy.pwn(12868) : warning 217: loose indentation
C:\Users\aNdRe\Downloads\UnderWorld Roleplay\UnderWorld Roleplay\gamemodes\UWRP16 - Copy.pwn(12870) : warning 217: loose indentation
C:\Users\aNdRe\Downloads\UnderWorld Roleplay\UnderWorld Roleplay\gamemodes\UWRP16 - Copy.pwn(12875) : error 010: invalid function or declaration
C:\Users\aNdRe\Downloads\UnderWorld Roleplay\UnderWorld Roleplay\gamemodes\UWRP16 - Copy.pwn(12878) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Here's the line.

Код:
CMD:getrefund(playerid, params[])
{
	if(PlayerInfo[playerid][pConnectTime] < 1)
	{
		SendClientMessage(playerid, COLOR_GRAD1, "You can't get your refunds, you need to have a 3 hours playing time!");
		return 1;
	 }
	 if(PlayerInfo[playerid][pConnectTime] <3)
	     PlayerInfo[playerid][pCash] = 100000;
	     PlayerInfo[playerid][pMats] = 1000;
	     PlayerInfo[playerid][pLevel] = 3;
	     PlayerInfo[playerid][pDonator] = 3;
	     return 1;
	 }
	 if(PlayerInfo[playerid][pConnectTime] <3)
	 {
		 SendClientMessage(playerid, COLOR_GRAD1, "Thanks for getting your refund! Enjoy!");
		 return 1;
	  }
   }
}
Reply
#2

pawn Код:
CMD:getrefund(playerid, params[])
{
    if(PlayerInfo[playerid][pConnectTime] < 1)
    {
        SendClientMessage(playerid, COLOR_GRAD1, "You can't get your refunds, you need to have a 3 hours playing time!");
        return 1;
    }
    if(PlayerInfo[playerid][pConnectTime] < 3)
    {
        PlayerInfo[playerid][pCash] = 100000;
        PlayerInfo[playerid][pMats] = 1000;
        PlayerInfo[playerid][pLevel] = 3;
        PlayerInfo[playerid][pDonator] = 3;
        SendClientMessage(playerid, COLOR_GRAD1, "Thanks for getting your refund! Enjoy!");
    }
    return 1;
}
That should work, although if the pConnectTime is over 3, they can use this command as much as they want and constantly get the 100k cash.
Reply
#3

Try this:
pawn Код:
CMD:getrefund(playerid, params[])
{
    if(PlayerInfo[playerid][pConnectTime] < 1)
    {
        SendClientMessage(playerid, COLOR_GRAD1, "You can't get your refunds, you need to have a 3 hours playing time!");
        return 1;
    }
    if(PlayerInfo[playerid][pConnectTime] <3) // If pConnectTime is the amount of hours played. This should be: PlayerInfo[playerid][pConnectTime] >=3. I left it just in case it wasn't.
    {
        PlayerInfo[playerid][pCash] = 100000;
        PlayerInfo[playerid][pMats] = 1000;
        PlayerInfo[playerid][pLevel] = 3;
        PlayerInfo[playerid][pDonator] = 3;
         
        SendClientMessage(playerid, COLOR_GRAD1, "Thanks for getting your refund! Enjoy!");
        return 1;
    }
}
Edit: Killer, beat me to it.
Reply
#4

Thanks guys for helping me. Fixed.
Reply
#5

But wait guys, how can i make it, if they got the /getrefund they can't get other one? Because i try many times the /getrefund it always getting the refund.
Reply
#6

pawn Код:
CMD:getrefund(playerid, params[])
{
    if(PlayerInfo[playerid][pConnectTime] < 1)
    {
        SendClientMessage(playerid, COLOR_GRAD1, "You can't get your refunds, you need to have a 3 hours playing time!");
        return 1;
    }
    if(PlayerInfo[playerid][pConnectTime] <3) // If pConnectTime is the amount of hours played. This should be: PlayerInfo[playerid][pConnectTime] >=3. I left it just in case it wasn't.
    {
        if(PlayerInfo[playerid[pRefunded] == 0)
        {
            PlayerInfo[playerid][pCash] = 100000;
            PlayerInfo[playerid][pMats] = 1000;
            PlayerInfo[playerid][pLevel] = 3;
            PlayerInfo[playerid][pDonator] = 3;
            PlayerInfo[playerid][pRefunded] = 1;
            SendClientMessage(playerid, COLOR_GRAD1, "Thanks for getting your refund! Enjoy!");
        }
        else if(PlayerInfo[playerid][pRefunded] == 1);
        {
            SendClientMessage(playerid, COLOR_GRAD1, "You've already been refunded!");
        }
        return 1;
    }
}

It's not tested, Try it though.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)