how do i make this?
#1

i want to make a scoreboard in the bottom left of the screen obn my server, and i want to make it so when grove kills ballas they get a point and the other way around, deathmatch style. how do i do that?
Reply
#2

Top:

Код:
new Text:TextDrawScore;
new String[50];
new TextDrawTimer;
new Kills[MAX_PLAYERS];
new Team1Kills, Team2Kills;

static gTeam[MAX_PLAYERS];

forward GetPlayersScores();
in OnGameModeInit():

Код:
TextDrawScore = CreateTextDraw(...);
TextDrawTimer = SetTimer("GetPlayersScores", 1000, true);
Other Textdraw Properties.
in OnGameModeExit():

Код:
KillTimer(TextDrawTimer);
in GetPlayerScores():
Код:
for ( new i = 0; i < MAX_PLAYERS; i++ ) {
  for ( new j = 0; j < Kills[i]; j++ ) {
    if ( gTeam[i] == 1 ) {
      Team1Kills++;
    } else if ( gTeam[i] == 2 ) {
      Team2Kills++;
    }
  }
}
format(String, sizeof String, "Team 1 Kills: %d\nTeam 2 Kills: %d", Team1Kills, Team2Kills);
TextDrawDestroy(...);
TextDrawSetString(...);
TextDrawShowForAll(...);
Sorry it is untested and im not a master at textdraws but i hope it helps

Good Luck
Reply
#3

here is a fixed ver

Top:

Код:
new Text:TextDrawScore;

new TextDrawTimer;
new Kills[MAX_PLAYERS];
new Team1Kills, Team2Kills;

static gTeam[MAX_PLAYERS];

forward GetPlayersScores();
in OnGameModeInit():

Код:
TextDrawScore = TextDrawCreate(600.0, 430.0, " ");
TextDrawTimer = SetTimer("GetPlayersScores", 1000, true);
TextDrawLetterSize(TextDrawScore, 0.4, 0.7);
TextDrawUseBox(TextDrawScore, 1);
TextDrawBoxColor(TextDrawScore, 0x0000FFFF);
in OnGameModeExit():

Код:
KillTimer(TextDrawTimer);
in GetPlayerScores():
Код:
for ( new i = 0; i < MAX_PLAYERS; i++ ) {
  for ( new j = 0; j < Kills[i]; j++ ) {
    if ( gTeam[i] == 1 ) {
      Team1Kills++;
    } else if ( gTeam[i] == 2 ) {
      Team2Kills++;
    }
  }
}
new String[50];
format(String, 50, "Team 1 Kills: %d\nTeam 2 Kills: %d", Team1Kills, Team2Kills);
TextDrawHideForAll(TextDrawScore);
TextDrawSetString(String);
TextDrawShowForAll(TextDrawScore);
but yet again, untested
Reply
#4

Thats what i done ?
The (...); meens input parameters ?
But still kl

but i forgot:

in OnPlayerDeath(playerid, killerid, reason):

Код:
Kills[killerid]++;
Oh i can see what you changed

Reply
#5

ok so umm, i have made my teams tea mgrove and team balla by using the tutorial shown here https://sampwiki.blast.hk/wiki/PAWN_tutorial can someone please answer my question and test it please? i do not want to be pushy, but neither of your guys's things worked. lol, thanks a lot for trying though.

~~[Drift]~~

-----[Modify]--------

Lol i have been looking up textdraws all day, and idk how to make it so when a team kills another, the thing goes up. >.<

and by the way jayme all of the things in th GetPlayerScores(); were invalid functions.
Reply
#6

LOL, Tested now,

and it did work,

here is a image:

Did not post with [ img ] tags the res is 1920 x 1200

/imageshack/img222/739/loly.jpg

This was a edit for CopsNGangs coded by kyeman

and here is the code:

http://pastebin.com/f5887c8a3

Enjoy
Reply
#7

Why don't you use OnPlayerDeath() callback to set the scores? Would be easier than that one.
Reply
#8

Damn, oh well its on a timer it works its good enough for me lol, and all you would have to do is copy the lines of code into on player death
Reply
#9

Every timer is a new callback that's being called very frequently, I'd still suggest using OnPlayerDeath instead of a timer, as OnPlayerDeath is called ONLY when the player dies, not every second and with a loop that goes through all players.
Reply
#10

well drift, unless you tell me this doesn't work i am not going to bother coding it for you, so pm me or not, i really don't care
Reply
#11

lol alright jayme i probably fucked up. =P thanks a lot! =)
Reply
#12

finally, you reply :P and your welcome
Reply
#13

yo JaYme i feel retarde right now, lol, on my server i am trying to use your method and the gangs are ballas and grove could you create me a script that it all ready and working please? i don't wnana ask too much. i try not to have people do the stuff for me, but im really stuck here. so if u do do it. thanks a lot! =).



~~[Drift]~~
Reply
#14

sorry for DP but i wanna show you, when i use dereks mode i have this error, can you tell me whats wrong?

Код:
C:\Users\rac\Desktop\gtasa and samp\gamemodes\choice.pwn(95) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
it says theres an error with this.
Код:
TextDrawSetString(String);
Reply
#15

Код:
TextDrawSetString(Text:text,string[]);
Reply
#16

lol jefff when i use yours i get this error.

Код:
C:\Users\rac\Desktop\gtasa and samp\gamemodes\choice.pwn(95) : error 017: undefined symbol "text"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#17

Ok, goto your server folder, open pawno folder, run pawno, make a new pawno file, press ctrl + a then back space, then paste all this code in it from http://pastebin.com/f5887c8a3
(code i made) and run on your server see if it works for you, just go kill some other people
Reply
#18

oh my god! i cannot thankyou enough!!!!!!! =) i just edited it a bit and now my server has points. XD ty so much!

~~[Drift]~~
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)