SA-MP Forums Archive
Help on getrefund - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help on getrefund (/showthread.php?tid=436582)



Help on getrefund - edgargreat - 12.05.2013

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;
	  }
   }
}



Re: Help on getrefund - [HiC]TheKiller - 12.05.2013

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.


Re: Help on getrefund - JJB562 - 12.05.2013

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.


Re: Help on getrefund - edgargreat - 12.05.2013

Thanks guys for helping me. Fixed.


Re: Help on getrefund - edgargreat - 12.05.2013

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.


Re: Help on getrefund - George_Fratelli - 18.05.2013

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.