Error and warning.
#1

When I am placing this on the GM:
Quote:

new name[256];
new kname[256];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(killerid, kname, sizeof(kname));
new string[128];
format(string, sizeof(string), "You were killed by %s", kname);
SendClientMessage(name, 0xFFFFFFAA, string);
format(string, sizeof(string), "You have killed %s", name);
SendClientMessage(killerid, 0xFFFFFFAA, string);

I got this warning and error:
Quote:

error 035: argument type mismatch (argument 1)
warning 219: local variable "string" shadows a variable at a preceding level

Reply
#2

pawn Код:
new name[256];
new kname[256];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(killerid, kname, sizeof(kname));
new msgg[128];
format(msgg, sizeof(string), "You were killed by %s", kname);
SendClientMessage(playerid, 0xFFFFFFAA, msgg);
format(msgg, sizeof(string), "You have killed %s", name);
SendClientMessage(killerid, 0xFFFFFFAA, msgg);
Reply
#3

Quote:
Originally Posted by kirollos
Посмотреть сообщение
pawn Код:
new name[256];
new kname[256];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(killerid, kname, sizeof(kname));
new msgg[128];
format(msgg, sizeof(string), "You were killed by %s", kname);
SendClientMessage(playerid, 0xFFFFFFAA, msgg);
format(msgg, sizeof(string), "You have killed %s", name);
SendClientMessage(killerid, 0xFFFFFFAA, msgg);
Errors
Quote:

error 017: undefined symbol "string"
error 029: invalid expression, assumed zero
warning 215: expression has no effect
error 017: undefined symbol "string"
error 029: invalid expression, assumed zero
warning 215: expression has no effect

Reply
#4

pawn Код:
new szString[128];
new name[24]; // max name is 24 please don't use 256 for names.
new kname[24]; // 24
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(killerid, kname, sizeof(kname));
format(szString, sizeof(szString), "You were killed by %s", kname);
SendClientMessage(playerid, 0xFFFFFFAA, szString);
format(szString, sizeof(szString), "You have killed %s", name);
SendClientMessage(killerid, 0xFFFFFFAA, szString);
There.
Reply
#5

Quote:
Originally Posted by AtItsMax
Посмотреть сообщение
pawn Код:
new szString[128];
new name[24]; // max name is 24 please don't use 256 for names.
new kname[24]; // 24
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(killerid, kname, sizeof(kname));
format(szString, sizeof(szString), "You were killed by %s", kname);
SendClientMessage(playerid, 0xFFFFFFAA, szString);
format(szString, sizeof(szString), "You have killed %s", name);
SendClientMessage(killerid, 0xFFFFFFAA, szString);
There.
Mhmm...
Quote:

error 017: undefined symbol "msgg"
error 017: undefined symbol "msgg"

Reply
#6

Quote:
Originally Posted by Misterflowers
Посмотреть сообщение
Mhmm...
Fixed a silly bug, try the edited one now.
Reply
#7

Awesome, +REP.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)