Score = Money + /me command + Car System
#1

Hi, I'm not sure how do to so score shows money of each player. I have that the score of everyone is shown 0

Anyway, does anybody know how to do a /me command? Please tell me how to make it, if possible. Thx.

And last, I would like a car system for my server, so people can buy cars, lock them, unlock them and when they enter car, it will say that it's their's (If you don't know this one, leave it, please answer first ones to me, they are more important)

Thank You and Regards
Puzi
Reply
#2

Quote:
Originally Posted by Puzi
Hi, I'm not sure how do to so score shows money of each player. I have that the score of everyone is shown 0

Anyway, does anybody know how to do a /me command? Please tell me how to make it, if possible. Thx.

And last, I would like a car system for my server, so people can buy cars, lock them, unlock them and when they enter car, it will say that it's their's (If you don't know this one, leave it, please answer first ones to me, they are more important)

Thank You and Regards
Puzi
1. Search
2. Search
3. Search
Reply
#3

pawn Код:
forward SetScore();

public OnGameModeInit()
{
   SetTimer("SetScore",1000,1);
   return 1;
}

public SetScore()
{
   for(new i = 0; i < MAX_PLAYERS; i++)
   {
     SetPlayerScore(i,GetPlayerMoney(i));
   }
   return 1;
}
Reply
#4

Under OnPlayerCommandText(playerid, cmdtext[])

pawn Код:
new tmp[256];

    cmd = strtok(cmdtext, idx);

    if(strcmp(cmdtext,"/me",true)==0)
{
  new pName[MAX_PLAYER_NAME];
  tmp = strtok(cmdtext,idx);
  if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_WHITE,"USAGE: /me [action]");
  if(IsPlayerConnected(playerid))
  {
   GetPlayerName(playerid,pName,sizeof(pName));
   format(string,sizeof(string),"%s %s",pName,cmdtext[7]);
   SendClientMessageToAll(COLOR_WHITE,string);
  }
  return 1;
}
Reply
#5

@Weed_: This doesn't work. These are errors I get

Код:
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1326) : error 017: undefined symbol "cmd"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1326) : error 017: undefined symbol "strtok"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1331) : error 017: undefined symbol "strtok"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1331) : error 033: array must be indexed (variable "tmp")
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1336) : error 017: undefined symbol "string"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1336) : error 017: undefined symbol "string"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1336) : error 029: invalid expression, assumed zero
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1336) : fatal error 107: too many error messages on one line

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


8 Errors.
@Ranked: Where do you stick this code in? Please tell me, as I'm not sure
Reply
#6

Quote:
Originally Posted by Puzi
@Weed_: This doesn't work. These are errors I get

Код:
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1326) : error 017: undefined symbol "cmd"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1326) : error 017: undefined symbol "strtok"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1331) : error 017: undefined symbol "strtok"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1331) : error 033: array must be indexed (variable "tmp")
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1336) : error 017: undefined symbol "string"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1336) : error 017: undefined symbol "string"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1336) : error 029: invalid expression, assumed zero
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1336) : fatal error 107: too many error messages on one line

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


8 Errors.
@Ranked: Where do you stick this code in? Please tell me, as I'm not sure
maybe some includes missing or someting ?
Reply
#7

Well, I have 'strtok' and 'tmp' so dunno
Reply
#8

Quote:
Originally Posted by Puzi
@Weed_: This doesn't work. These are errors I get

Код:
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1326) : error 017: undefined symbol "cmd"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1326) : error 017: undefined symbol "strtok"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1331) : error 017: undefined symbol "strtok"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1331) : error 033: array must be indexed (variable "tmp")
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1336) : error 017: undefined symbol "string"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1336) : error 017: undefined symbol "string"
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1336) : error 029: invalid expression, assumed zero
C:\DOCUME~1\KAMIL\Pulpit\RPGTDM~1\RPG.pwn(1336) : fatal error 107: too many error messages on one line

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


8 Errors.
@Ranked: Where do you stick this code in? Please tell me, as I'm not sure
You need strtok. Put this at the bottom of your script:
pawn Код:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Edit: Oops, I guess you already have it.
Reply
#9

On top

pawn Код:
#define COLOR_WHITE 0xFFFFFFAA
Somewhere in your script

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
Under it

pawn Код:
new tmp[256];
new cmd[256];
cmd = strtok(cmdtext, idx)
The command

pawn Код:
if(strcmp(cmdtext,"/me",true)==0)
{
 new pName[MAX_PLAYER_NAME];
 tmp = strtok(cmdtext,idx);
 if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_WHITE,"USAGE: /me [action]");
 if(IsPlayerConnected(playerid))
 {
   GetPlayerName(playerid,pName,sizeof(pName));
   format(string,sizeof(string),"%s %s",pName,cmdtext[7]);
   SendClientMessageToAll(COLOR_WHITE,string);
 }
 return 1;
}
Reply
#10

Ermm My script Got this :

Код:
if(strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me
  {
    if(cmdtext[3] == 0) {
      SendClientMessage(playerid, 0xFF0000FF, "USAGE: /me [action]");
      return 1;
    }
    new str[128];
    GetPlayerName(playerid, str, sizeof(str));
    format(str, sizeof(str), "* %s %s", str, cmdtext[4]);    SendClientMessageToAll(0xFFFF00AA, str);
    }
It should Work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)