Help with one commands!
#1

Hey, could someone help me with a little command? I am pretty blank on making it working as im still a newbie scripter ^^,

/id [playername OR id]

When you put that in it gotta check if your online or not... if not then it says so... If you are then it shows up:

ID:[id number] - Playername - Level: [Playerscore]

You have to be able to put in ID or name of the person and then it shows up ...
Reply
#2

try this
pawn Код:
if(strcmp(cmd, "/id", true) == 0)
{
  tmp = strtok(cmdtext, idx);
  if(!strlen(tmp))
  {
    SendClientMessage(playerid, COLOR_GREY, "USAGE: /id [playerid/Name]");
    return 1;
  }
  new pl;
  pl = ReturnUser(tmp);
  if(pl == INVALID_PLAYER_ID)
  {
    SendClientMessage(playerid, COLOR_LIGHTRED, "INVALID PLAYER ID !");
    return 1;
  }
  new name[MAX_PLAYER_NAME]; GetPlayerName(pl name, sizeof(name));
  new str[256]; format(str, sizeof(str), "ID:%d| Name: %s| Score:%d", pl, name, GetPlayerScore(pl));
  SendClientMessage(playerid, COLOR_LIGHTBLUE, str);  
  new name2[MAX_PLAYER_NAME]; GetPlayerName(playerid, name2, sizeof(name2));
  new str[256]; format(str, sizeof(str), "%s is checking you", name2);
  SendClientMessage(pl COLOR_GREEN, str);  
  return 1;
}
this warn the player that you are checking too

Reply
#3

Why ReturnUser ? That's just a lame copypaste, it's not a default function. 100$ he's gonna come back with the error "Undefined symbol: ReturnUser"

lololol.
Reply
#4

Quote:
Originally Posted by James_Alex(Coder)
try this
pawn Код:
if(strcmp(cmd, "/id", true) == 0)
{
  tmp = strtok(cmdtext, idx);
  if(!strlen(tmp))
  {
    SendClientMessage(playerid, COLOR_GREY, "USAGE: /id [playerid/Name]");
    return 1;
  }
  new pl;
  pl = ReturnUser(tmp);
  if(pl == INVALID_PLAYER_ID)
  {
    SendClientMessage(playerid, COLOR_LIGHTRED, "INVALID PLAYER ID !");
    return 1;
  }
  new name[MAX_PLAYER_NAME]; GetPlayerName(pl name, sizeof(name));
  new str[256]; format(str, sizeof(str), "ID:%d| Name: %s| Score:%d", pl, name, GetPlayerScore(pl));
  SendClientMessage(playerid, COLOR_LIGHTBLUE, str);  
  new name2[MAX_PLAYER_NAME]; GetPlayerName(playerid, name2, sizeof(name2));
  new str[256]; format(str, sizeof(str), "%s is checking you", name2);
  SendClientMessage(pl COLOR_GREEN, str);  
  return 1;
}
this warn the player that you are checking too

That gives me:

Код:
C:\Spil\GTA San Andreas\GTA San Andreas\samp\gamemodes\new.pwn(101) : error 017: undefined symbol "cmd"
C:\Spil\GTA San Andreas\GTA San Andreas\samp\gamemodes\new.pwn(103) : error 017: undefined symbol "tmp"
C:\Spil\GTA San Andreas\GTA San Andreas\samp\gamemodes\new.pwn(103) : error 017: undefined symbol "strtok"
C:\Spil\GTA San Andreas\GTA San Andreas\samp\gamemodes\new.pwn(104) : error 017: undefined symbol "tmp"
C:\Spil\GTA San Andreas\GTA San Andreas\samp\gamemodes\new.pwn(106) : error 017: undefined symbol "COLOR_GREY"
C:\Spil\GTA San Andreas\GTA San Andreas\samp\gamemodes\new.pwn(110) : error 017: undefined symbol "ReturnUser"
C:\Spil\GTA San Andreas\GTA San Andreas\samp\gamemodes\new.pwn(113) : error 017: undefined symbol "COLOR_LIGHTRED"
C:\Spil\GTA San Andreas\GTA San Andreas\samp\gamemodes\new.pwn(116) : error 001: expected token: ",", but found "-identifier-"
C:\Spil\GTA San Andreas\GTA San Andreas\samp\gamemodes\new.pwn(116) : warning 215: expression has no effect
C:\Spil\GTA San Andreas\GTA San Andreas\samp\gamemodes\new.pwn(116) : warning 215: expression has no effect
C:\Spil\GTA San Andreas\GTA San Andreas\samp\gamemodes\new.pwn(116) : error 001: expected token: ";", but found ")"
C:\Spil\GTA San Andreas\GTA San Andreas\samp\gamemodes\new.pwn(116) : error 029: invalid expression, assumed zero
C:\Spil\GTA San Andreas\GTA San Andreas\samp\gamemodes\new.pwn(116) : fatal error 107: too many error messages on one line

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


11 Errors.
://
Reply
#5

read this
http://forum.sa-mp.com/index.php?topic=109339.0
Reply
#6

Quote:
Originally Posted by James_Alex(Coder)
When i add that my old commands go "undefined" and everything fucks up...
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)