Server crashes when a player gets killed.
#1

Hello guys,i got a problem with my script.The server crashes when i shoot the player the 3th time...When he should die the server crash.Ill put here my OnPlayerDeath:
public OnPlayerDeath(playerid, killerid, reason)
{
SetPlayerScore(killerid,GetPlayerScore(killerid)+1 );
ECash[playerid] += 2;
SendClientMessage(killerid, "a message...");
SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
ECash[playerid] -= 1;
SendClientMessage(playerid, "another message...");
return 1;
}
Thanks.
Reply
#2

Try chaning
pawn Код:
ECash[playerid] += 2;
to
pawn Код:
ECash[killerid] += 2;
Reply
#3

is you ECash array big enough? It should be
new ECash[MAX_PLAYERS];
for example. If the array index is out of bounds (new ECash[2], ECash[12] +=2) this could crash the server.
Reply
#4

Quote:
Originally Posted by Lynn
Посмотреть сообщение
Try chaning
pawn Код:
ECash[playerid] += 2;
to
pawn Код:
ECash[killerid] += 2;
Ive tried that but still i get the same errors:
new.pwn(401) : error 035: argument type mismatch (argument 2)
new.pwn(404) : error 035: argument type mismatch (argument 2)
Reply
#5

Are the error lines the SendCcientMessage stuff? I guess so, you are missing the color parameter there.

change
SendClientMessage(killerid, "a message...");
to
SendClientMessage(killerid, 0xFF3333FF, "a message...");

in both cases

0xFF3333FF is a color code, change it to whatever color you would like, this is red now. There are infos about this in the wiki and the forum.
Reply
#6

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
Are the error lines the SendCcientMessage stuff? I guess so, you are missing the color parameter there.

change
SendClientMessage(killerid, "a message...");
to
SendClientMessage(killerid, 0xFF3333FF, "a message...");

in both cases

0xFF3333FF is a color code, change it to whatever color you would like, this is red now. There are infos about this in the wiki and the forum.
Yeah seems like i forgot the colours,i did it in rush .Thanks guys,i dont get the errors now,ill test it and see if now it works fine.
edit:Oke,it fixed now,i needed to remove the part where the killer gets the score and the ECash,but anyone has any idea where to add the thingy which give's to the killer the score and ecash?Thanks
Reply
#7

Up with this
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)