Variable text displayed
#1

Alright, now, if some one kills some one, i want it to display "Killer's name Killed Killed Name"
I've got some thing like

public OnPlayerDeath(playerid, killerid, reason)
{
GameTextForPlayer(playerid, "Wasted!", 3500, 2);
SetPlayerWantedLevel(killerid,7);
GetPlayerName(killerid, killername);
SendClientMessageToAll(0x00EEEE, killername);
return 1;
}

How can i get it to display the killer's name, then the person's name who was killed?

I just gotta get the basics down and i'll be able to do this with out any assistance XD
Reply
#2

Quote:
Originally Posted by Property_Control
Alright, now, if some one kills some one, i want it to display "Killer's name Killed Killed Name"
I've got some thing like

public OnPlayerDeath(playerid, killerid, reason)
{
GameTextForPlayer(playerid, "Wasted!", 3500, 2);
SetPlayerWantedLevel(killerid,7);
GetPlayerName(killerid, killername);
SendClientMessageToAll(0x00EEEE, killername);
return 1;
}

How can i get it to display the killer's name, then the person's name who was killed?

I just gotta get the basics down and i'll be able to do this with out any assistance XD
GetPlayerName, Killerid, Playerid.
Reply
#3

Yea, but how do i display it?
Reply
#4

Put this at the top of your script as it is very useful.
pawn Код:
stock PlayerName(playerid) {
 new name[16];
 GetPlayerName(playerid, name, sizeof(name));
 return name;
}
And here is the code you want.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new string[128];
    format(string,sizeof(string),"%s wasted %s!",PlayerName(killerid),PlayerName(playerid));
    SetPlayerWantedLevel(killerid,7);
    SendClientMessageToAll(0x00EEEE, string);
    return 1;
}
Also, I'm pretty sure the most wanted level you can get is 6.
Reply
#5

Thanks! but mind explaining what all that %s stuff is? i have a good guess but i'm not 100% sure.
Reply
#6

https://sampwiki.blast.hk/wiki/Format

That link explains it all.
Reply
#7

Rofl, the function's not working,

Quote:

C:\Documents and Settings\PROPCO\My Documents\samp02Xserver.win32\gamemodes\test.pwn(8 7) : error 017: undefined symbol "PlayerName"

I'm starting to regret learning this, PAWNO should be more forgiving like PHP...
Reply
#8

Where is it saying undefined? Paste line 87 please.

Edit: I hope you pasted that function above or below OnPlayerDeath but not inside of it..

Edit 2: I just compiled it and it worked perfectly. You must have misplaced something.
Reply
#9

Pasted it below #include <a_samp> and #if defined FILTERSCRIPT, and line 87 is
Quote:

format(string,sizeof(string),"%s wasted %s!",PlayerName(killerid),PlayerName(playerid));

Reply
#10

Put all functions below main().

pawn Код:
main()
{
    print("\n----------------------------------");
    print(" Your gamemode");
    print("----------------------------------\n");
}

//All functions go below main().
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)