SA-MP Forums Archive
Help Please :( - 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: Help Please :( (/showthread.php?tid=273518)



Help Please :( - Alex_Obando - 02.08.2011

pawn Код:
public OnPlayerText(playerid, text[])
{


    new string[128], name[24];
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "[ID: %d]%s: %s", playerid, name, text);
    SendClientMessageToAll(GetPlayerColor(playerid), string);
pawn Код:
C:\Users\Alex\Desktop\Otros\CodSamp\codsamp_aw\gamemodes\COD5.pwn(5328) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Alex\Desktop\Otros\CodSamp\codsamp_aw\gamemodes\COD5.pwn(5338) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Alex\Desktop\Otros\CodSamp\codsamp_aw\gamemodes\COD5.pwn(5339) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Users\Alex\Desktop\Otros\CodSamp\codsamp_aw\gamemodes\COD5.pwn(5379) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Alex\Desktop\Otros\CodSamp\codsamp_aw\gamemodes\COD5.pwn(5396) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Alex\Desktop\Otros\CodSamp\codsamp_aw\gamemodes\COD5.pwn(5428) : error 021: symbol already defined: "string"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.



Respuesta: Help Please :( - Alex_Obando - 02.08.2011

How about this:

pawn Код:
public OnPlayerText(playerid, text[])
{


    new str[128], Name[24];
    new Year, Month, Day;
    getdate(Year, Month, Day);

    GetPlayerName(playerid, Name, sizeof(Name));
    format(str, sizeof(str), "[%d/%d/%d][ID: %d]%s: %s", Year, Month, Day, playerid, Name, text);
    SendClientMessageToAll(GetPlayerColor(playerid), str);
No errors but I can see while chatting the message twice.
And I can see all the text blue.



Re: Help Please :( - Kush - 02.08.2011

Set the return value to 0.


Respuesta: Help Please :( - Alex_Obando - 02.08.2011

pawn Код:
new str[128], Name[24];
    new Year, Month, Day;
    getdate(Year, Month, Day);

    GetPlayerName(playerid, Name, sizeof(Name));
    format(str, sizeof(str), "[%d/%d/%d][ID: %d]%s: %s", Year, Month, Day, playerid, Name, text);
    SendClientMessageToAll(GetPlayerColor(playerid), str);
    return 0;
pawn Код:
C:\Users\Alex\Desktop\Otros\CodSamp\codsamp_aw\gamemodes\COD5.pwn(5313) : warning 225: unreachable code



Re: Respuesta: Help Please :( - Kush - 02.08.2011

Quote:
Originally Posted by Alex_Obando
Посмотреть сообщение
pawn Код:
new str[128], Name[24];
    new Year, Month, Day;
    getdate(Year, Month, Day);

    GetPlayerName(playerid, Name, sizeof(Name));
    format(str, sizeof(str), "[%d/%d/%d][ID: %d]%s: %s", Year, Month, Day, playerid, Name, text);
    SendClientMessageToAll(GetPlayerColor(playerid), str);
    return 0;
pawn Код:
C:\Users\Alex\Desktop\Otros\CodSamp\codsamp_aw\gamemodes\COD5.pwn(5313) : warning 225: unreachable code
The return value of the OnPlayerText function.