#1

Hi, i wanna request a script. Little info - i want script where you can buy level, for example - Level 1 for 250 000 $ and then you can use a command, like /flip or something else, but players who hasn't level 1 can't use it, and you can only buy levle 2 if you are level 1. all what i want is just one level, so i can make my own. i have searched, but never found what i need ;( . please, help i really need this!

Sorry, if i writted this in wrong topic. (in script request topic nobody answerd me) and sorry for my bad english!
Reply
#2

There's a script request thread for a reason...
Reply
#3

sorry, if you want you can delete this topic...
Reply
#4

Look, it takes a couple simple variables and a command. Here..

Код:
new gPlayerLevel[MAX_PLAYERS]; // above main()
new gPlayerMoney[MAX_PLAYERS];

public OnPlayerCommandText(playerid, cmdtext[])
{
  if (strcmp(cmd, "/buylevel", true) == 0)
  {
    gPlayerMoney[playerid] = GetPlayerMoney(playerid);
    if (GetPlayerMoney(playerid) >= 250000)
    {
      gPlayerLevel[playerid] += 1;
      SetPlayerMoney(playerid, gPlayerMoney[playerid] - 250000);
    }
    return 1;
  }
  if (strcmp(cmd, "/flip", true) == 0)
  {
    if (gPlayerLevel[playerid] > 1)
    {
      SendClientMessage(playerid, 0xFFFFFFFF, "I just... flipped?");
      return 1;
    }
    else
      return SendClientMessage(playerid, 0xFFFFFFFF, "You are not high enough level to use this!");
  }
}
Not tested, but should work.
Reply
#5

Why goes gPlayerMoney need to be an array?

Answer: it doesn't :P
Reply
#6

thank you I will test!

EDIT: It shows some errors:

Код:
C:\Documents and Settings\Install\Desktop\HOSTS\gamemodes\xlight.pwn(1128) : error 017: undefined symbol "cmd"
C:\Documents and Settings\Install\Desktop\HOSTS\gamemodes\xlight.pwn(1138) : error 017: undefined symbol "cmd"
C:\Documents and Settings\Install\Desktop\HOSTS\gamemodes\xlight.pwn(1148) : warning 209: function "OnPlayerCommandText" should return a value
C:\Documents and Settings\Install\Desktop\HOSTS\gamemodes\xlight.pwn(1330) : warning 217: loose indentation
C:\Documents and Settings\Install\Desktop\HOSTS\gamemodes\xlight.pwn(1364) : warning 235: public function lacks forward declaration (symbol "SetupPlayerForClassSelection")
C:\Documents and Settings\Install\Desktop\HOSTS\gamemodes\xlight.pwn(1581) : warning 235: public function lacks forward declaration (symbol "GameModeExitFunc")
C:\Documents and Settings\Install\Desktop\HOSTS\gamemodes\xlight.pwn(1689) : warning 203: symbol is never used: "ret_memcpy"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
EDIT 2: I just did this:

Код:
#define cmd
#define cmd
and now i've got this:
Код:
C:\Documents and Settings\Install\Desktop\HOSTS\gamemodes\xlight.pwn(1128) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Install\Desktop\HOSTS\gamemodes\xlight.pwn(1128) : warning 215: expression has no effect
C:\Documents and Settings\Install\Desktop\HOSTS\gamemodes\xlight.pwn(1128) : warning 215: expression has no effect
C:\Documents and Settings\Install\Desktop\HOSTS\gamemodes\xlight.pwn(1128) : error 001: expected token: ";", but found ")"
C:\Documents and Settings\Install\Desktop\HOSTS\gamemodes\xlight.pwn(1128) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Install\Desktop\HOSTS\gamemodes\xlight.pwn(1128) : fatal error 107: too many error messages on one line

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


4 Errors.
any ideas?
Reply
#7

Remove those #define's. Change the strcmp(cmd to strcmp(cmdtext. That will resolve those two errors properly, and allow you to process the commands. Post the relevant code including line numbers for each warning, and we'll work on getting those resolved next.
Reply
#8

You're going to get loose indentation and all that.. I typed it in a code box not in pawn.

You need to adjust the script as needed. IT was not intended to work exactly with your code. Change it as needed..
Reply
#9

now my command looks like that:

Код:
	public OnPlayerCommandText(playerid, cmdtext[])
	{
	if (strcmp(cmdtext"/buylevel", true) == 0;
	{
    gPlayerMoney[playerid] = GetPlayerMoney(playerid);
    if (GetPlayerMoney(playerid) >= 250000)
    {
      gPlayerLevel[playerid] += 1;
      SetPlayerMoney(playerid, gPlayerMoney[playerid] - 250000);
    }
    return 1;
  }
  if (strcmp(cmdtext"/flip", true) == 0)
  {
    if (gPlayerLevel[playerid] > 1)
    {
      SendClientMessage(playerid, 0xFFFFFFFF, "I just... flipped?");
      return 1;
    }
    else
      return SendClientMessage(playerid, 0xFFFFFFFF, "You are not high enough level to use this!");
  }
}
but i still got errors:

Код:
C:\Documents and Settings\Install\Desktop\HOSTS\gamemodes\xlight.pwn(1127) : error 001: expected token: ",", but found "-string-"
C:\Documents and Settings\Install\Desktop\HOSTS\gamemodes\xlight.pwn(1127) : warning 215: expression has no effect
C:\Documents and Settings\Install\Desktop\HOSTS\gamemodes\xlight.pwn(1127) : warning 215: expression has no effect
C:\Documents and Settings\Install\Desktop\HOSTS\gamemodes\xlight.pwn(1127) : error 001: expected token: ";", but found ")"
C:\Documents and Settings\Install\Desktop\HOSTS\gamemodes\xlight.pwn(1127) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Install\Desktop\HOSTS\gamemodes\xlight.pwn(1127) : fatal error 107: too many error messages on one line

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


4 Errors.
all warnings and errors are on this line:

Код:
if (strcmp(cmdtext"/buylevel", true) == 0;
If it's important - my gm is made from sftdm!

Reply
#10


pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
    {
    if (strcmp(cmd, "/buylevel", true) == 0)
    {
    gPlayerMoney[playerid] = GetPlayerMoney(playerid);
    if (GetPlayerMoney(playerid) >= 250000)
    {
     gPlayerLevel[playerid] += 1;
     SetPlayerMoney(playerid, gPlayerMoney[playerid] - 250000);
    }
    return 1;
  }
  if (strcmp(cmdtext"/flip", true) == 0)
  {
    if (gPlayerLevel[playerid] > 1)
    {
      SendClientMessage(playerid, 0xFFFFFFFF, "I just... flipped?");
      return 1;
    }
    else
      return SendClientMessage(playerid, 0xFFFFFFFF, "You are not high enough level to use this!");
  }
}
Put like this
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)