09.03.2012, 12:23
My Code isn't working and I have no idea why. Help me out
and yes it compiles. just nothing works
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new st[128],str[128],name[MAX_PLAYER_NAME], Killername[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
GetPlayerName(killerid,Killername,sizeof(Killername));
PlayerInfo[playerid][pArm] = 0;
PlayerInfo[playerid][pHP] = 0;
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
GivePlayerCash(killerid, 2500);
PlayerInfo[killerid][pKills]+= 1;
PlayerInfo[killerid][pStreak]+= 1;
PlayerInfo[playerid][pStreak] = 0;
PlayerInfo[playerid][pDeaths] += 1;
Delete3DTextLabel(Killer[playerid]);
SendDeathMessage(killerid,playerid,reason);
SetPlayerWantedLevel(playerid,0);
LooseWeapons(playerid);
{
if(gTeam[killerid] == gTeam[playerid]) {
GameTextForPlayer(killerid, "~r~DON'T TEAMKILL!",5000,5);
PlayerInfo[killerid][pTeamKill]+= 1;
GivePlayerCash(killerid, -5000);
GivePlayerCash(playerid, 5000);
}
if(PlayerInfo[killerid][pTeamKill] == 2) {
SendClientMessage(killerid,COLOR_YELLOW,"Don't Team Kill! (Warning 1/3).");
}
if(PlayerInfo[killerid][pTeamKill] == 3) {
SendClientMessage(killerid,COLOR_YELLOW,"You're being jailed for 2 minutes for constant team killing. ");
TogglePlayerControllable(killerid, 0);
Punishment(killerid, 120);
}
if(PlayerInfo[killerid][pTeamKill] == 4) {
format(st, sizeof(st), "SERVER: %s Is Kicked For Team Killing.", Killername);
SendClientMessageToAll(COLOR_LIGHTRED, st);
PlayerInfo[killerid][pTeamKill] = 0;
Kick(killerid);
}
if(InDual[playerid] == 1)
{
InDual[playerid] = 0;
InDual[killerid] = 0;
format(st, sizeof(st), "%s Beat %s In A Duel And Won $%d", Killername, name, DualRoomprice);
SendClientMessageToAll(COLOR_YELLOW, st);
GivePlayerCash(killerid, (DualRoomprice*2));
SpawnPlayer(killerid);
SendDeathMessage(killerid, playerid, reason);
}
if(PlayerInfo[playerid][pStreak] >= 50) {
format(st,sizeof(st),"~P~ %s Has Killed %s",Killername,name);
GameTextForAll(st,5500,5);
GivePlayerCash(killerid, 20000);
}
if(PlayerInfo[killerid][pStreak] == 5) {
format(st,sizeof(st),"~W~%s HAS A KILL STREAK OF 5!",Killername);
PlayerInfo[killerid][pArm] = 0;
PlayerInfo[killerid][pHP] = 0;
SetPlayerWantedLevel(killerid,1);
GameTextForAll(st,5000,4);
GivePlayerCash(killerid, 50000);
}
if(PlayerInfo[killerid][pStreak] == 10) {
format(st,sizeof(st),"~W~%s HAS A KILL STREAK OF 10!!",Killername);
SetPlayerWantedLevel(killerid,2);
GameTextForAll(st,5000,4);
}
if(PlayerInfo[killerid][pStreak] == 15) {
format(st,sizeof(st),"~W~%s HAS A KILL STREAK OF 15!!!",Killername);
PlayerInfo[killerid][pArm] = 0;
PlayerInfo[killerid][pHP] = 0;
SetPlayerWantedLevel(killerid,3);
GameTextForAll(st,5000,4);
}
if(PlayerInfo[killerid][pStreak] == 20) {
format(st,sizeof(st),"~W~%s HAS A KILL STREAK OF 20!!!!",Killername);
GivePlayerCash(killerid, 100000);
SetPlayerWantedLevel(killerid,4);
GameTextForAll(st,5000,4);
}
if(PlayerInfo[killerid][pStreak] == 25) {
format(st,sizeof(st),"~W~%s HAS A KILL STREAK OF 25!!!!!",Killername);
PlayerInfo[killerid][pArm] = 0;
PlayerInfo[killerid][pHP] = 0;
SetPlayerWantedLevel(killerid,5);
GameTextForAll(st,5000,4);
}
if(PlayerInfo[killerid][pStreak] == 30) {
format(st,sizeof(st),"~R~%s HAS A KILL STREAK OF 30!!!!!!",Killername[killerid]);
GameTextForAll(st,5000,4);
}
if(PlayerInfo[killerid][pStreak] == 35) {
format(st,sizeof(st),"~R~%s HAS A KILL STREAK OF 35!!!!!!",Killername[killerid]);
PlayerInfo[killerid][pArm] = 0;
PlayerInfo[killerid][pHP] = 0;
GivePlayerCash(killerid, 150000);
SetPlayerWantedLevel(killerid,6);
GameTextForAll(st,5000,4);
}
if(PlayerInfo[killerid][pStreak] == 40) {
format(st,sizeof(st),"~R~%s HAS A KILL STREAK OF 40!!!!!!",Killername[killerid]);
GameTextForAll(st,5000,4);
}
if(PlayerInfo[killerid][pStreak] == 45) {
format(st,sizeof(st),"~R~%s HAS A KILL STREAK OF 45!!!!!!",Killername[killerid]);
SendClientMessage(killerid,COLOR_YELLOW,"Buy better guns! (/shop) be prepared for the 50 kill streak!");
PlayerInfo[killerid][pArm] = 0;
PlayerInfo[killerid][pHP] = 0;
GivePlayerCash(killerid, 1000000);
PlayerInfo[killerid][pWantedLevel]++;
GameTextForAll(st,5000,4);
}
for(new i=0;i<MAX_PLAYERS;i++)
if(PlayerInfo[killerid][pStreak] == 50) {
new Float:X,Float:Y,Float:Z;
GetPlayerPos(killerid, X,Y,Z);
SetPlayerPos(i,X+1,Y+1,Z+1);
format(st,sizeof(st),"~G~%s HAS A KILL STREAK OF 50. KILL THEM",Killername);
SendClientMessageToAll(COLOR_YELLOW,st);
format(st,sizeof(st),"~R~ !!!!! KILL %s !!!!!",Killername);
GameTextForAll(st,5500,5);
SetPlayerChatBubble(killerid, "** K I L L M E!! **", COLOR_RED, 100.0, 10000);
if(gTeam[i]==gTeam[killerid])
{
format(str,sizeof(str),"%s Is on a kill streak! Protect him",Killername);
SendClientMessage(i, COLOR_LIGHTBLUE, str);
}
if(PlayerInfo[killerid][pStreak]>= 50) {
new streak = PlayerInfo[killerid][pStreak];
format(st,sizeof(st),"~R~%s HAS A KILL STREAK OF %d",Killername,streak);
GameTextForAll(st,5000,4);
}
if(PlayerInfo[killerid][pStreak] == 100) {
new streak = PlayerInfo[killerid][pStreak];
GivePlayerCash(killerid, 2500000);
format(st,sizeof(st),"~R~%s HAS A KILL STREAK OF %d",Killername,streak);
PlayerInfo[killerid][pArm] = 0;
PlayerInfo[killerid][pHP] = 0;
GameTextForAll(st,5000,4);
}
}
if(joiningevent[playerid] == 1){
participants--;
joiningevent[playerid] = 0;
if(participants == 1){
foreach(Player, i){
if(joiningevent[i] == 1){
new string[128], player_Name[MAX_PLAYER_NAME];
GetPlayerName(i, player_Name, sizeof(player_Name));
GivePlayerCash(i, 100000);
joiningevent[i] = 0;
participants = 0;
SetPlayerHealth(i,0.0);
SetPlayerInterior(i,0);
if(lastman == 1){
format(string, sizeof(string), "%s Earned $100,000 For Winning Last Man Standing!", player_Name);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
lastman =0;
}
if(derby == 1){
format(string, sizeof(string), "%s Earned $100,000 For Winning The Destruction Derby!", player_Name);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
derby = 0;
}
if(joiningevent[i] == 0){
SendClientMessageToAll(COLOR_LIGHTBLUE, "The Event Has Come To An End");
}
}
}
}
}
}
return 1;
}