SA-MP Forums Archive
Score = Money + /me command + Car System - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Score = Money + /me command + Car System (/showthread.php?tid=71204)



Score = Money + /me command + Car System - Puzi - 30.03.2009

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


Re: Score = Money + /me command + Car System - Dujma - 30.03.2009

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


Re: Score = Money + /me command + Car System - tom_jonez - 30.03.2009

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



Re: Score = Money + /me command + Car System - Weed_ - 30.03.2009

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



Re: Score = Money + /me command + Car System - Puzi - 30.03.2009

@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


Re: Score = Money + /me command + Car System - Divine - 30.03.2009

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 ?


Re: Score = Money + /me command + Car System - Puzi - 30.03.2009

Well, I have 'strtok' and 'tmp' so dunno


Re: Score = Money + /me command + Car System - Pyrokid - 30.03.2009

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.


Re: Score = Money + /me command + Car System - Weed_ - 31.03.2009

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



Re: Score = Money + /me command + Car System - basker - 01.04.2009

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