What's the problem?
#1

after when i got my server portforwarded i got my friend to test something we were testing but if i kill him 3 times my samp-server.exe (black box thing) closes automaticaly.. i got killing spree thing.. anyone know what's the problem?
pawn Code:
public OnPlayerDeath(playerid, killerid, reason) {
        new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
        #pragma unused string
        GetPlayerName(playerid, pname, sizeof(pname));
        KillingSpree[killerid] ++;
        KillingSpree[playerid] = 0;

        if(KillingSpree[killerid] == 3) {
         SendClientMessage(playerid,COLOR_ORANGE,"%s is on killing spree!");
        }
        return 1;
    }
Reply
#2

You must Use the format function
pawn Code:
if(KillingSpree[killerid] == 3) {
        GetPlayerName(killerid,pname,sizeof(pname));
        format(string,sizeof(string),"%s is on a killing spree",pname);
         SendClientMessageToAll(COLOR_ORANGE,string);

        }
Remove this #pragma unused string
Reply
#3

i removed the #pragma unused string Now it gives
pawn Code:
E:\GTA - San Andreas\Pawno Scripting\gamemodes\Script.pwn(373) : warning 204: symbol is assigned a value that is never used: "string"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.
Reply
#4

did u add this Line ?
pawn Code:
SendClientMessageToAll(COLOR_ORANGE,string);
Reply
#5

here it is btw, String??
pawn Code:
public OnPlayerDeath(playerid, killerid, reason) {
        new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
        GetPlayerName(playerid, pname, sizeof(pname));
        KillingSpree[killerid] ++;
        KillingSpree[playerid] = 0;

        if(KillingSpree[killerid] == 3) {
         SendClientMessage(playerid,COLOR_ORANGE,"%s is on killing spree!");
        }
        return 1;
    }
Reply
#6

You can't use sendclientmessage like that! As CSSI said, you should use format:

pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
    new
        pname[ MAX_PLAYER_NAME ], string[ 39 + MAX_PLAYER_NAME ];
       
    GetPlayerName( playerid, pname, sizeof ( pname ) );
   
    KillingSpree[ killerid ] ++;
    KillingSpree[ playerid ] = 0;
   
    format ( string, sizeof ( string ), "%s is on killing spree!", pname );
   
    if ( KillingSpree[ killerid ] == 3 )
    {
        SendClientMessage( playerid, COLOR_ORANGE, string);
    }
    return true;
}
Reply
#7

pawn Code:
public OnPlayerDeath(playerid, killerid, reason) {
        KillingSpree[killerid] ++;
        KillingSpree[playerid] = 0;
         if(KillingSpree[killerid] == 3) {
         new pname[24],string[128];
          GetPlayerName(killerid, pname, sizeof(pname));
         format(string,sizeof(string),"%s is on a killing spree!",pname);
         SendClientMessageToAll(COLOR_ORANGE,string);
        }

        return 1;
    }
Reply
#8

Try:
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
    new pname[24],string[128];
    GetPlayerName(killerid, pname, sizeof(pname));
    KillingSpree[killerid] ++;
    KillingSpree[playerid] = 0;
    if(KillingSpree[killerid] == 3)
    {
        format(string,sizeof(string),"%s is on a killing spree with %d kills",pname,KillingSpree[killerid]);
        SendClientMessageToAll(COLOR_ORANGE,string);
    }
    if(KillingSpree[killerid] == 6)
    {
        format(string,sizeof(string),"%s is on a killing spree with %d kills",pname,KillingSpree[killerid]);
        SendClientMessageToAll(COLOR_ORANGE,string);
    }
    if(KillingSpree[killerid] == 9)
    {
        format(string,sizeof(string),"%s is on a killing spree with %d kills",pname,KillingSpree[killerid]);
        SendClientMessageToAll(COLOR_ORANGE,string);
    }
    if(KillingSpree[killerid] == 12)
    {
        //ect......
    }
    return 1;
}
Reply
#9

Thanks yall anyone know how can i make if someone kill a player with 3 kills get 1k etc?
Reply
#10

Quote:
Originally Posted by Mr_Scripter
View Post
Thanks yall anyone know how can i make if someone kill a player with 3 kills get 1k etc?
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
    new pname[24],string[128];
    GetPlayerName(killerid, pname, sizeof(pname));
    KillingSpree[killerid] ++;
    KillingSpree[playerid] = 0;
    if(KillingSpree[killerid] == 3)
    {
        format(string,sizeof(string),"%s is on a killing spree with %d kills",pname,KillingSpree[killerid]);
        SendClientMessageToAll(COLOR_ORANGE,string);
        GivePlayerMoney(killerid, 1000);
    }
    if(KillingSpree[killerid] == 6)
    {
        format(string,sizeof(string),"%s is on a killing spree with %d kills",pname,KillingSpree[killerid]);
        SendClientMessageToAll(COLOR_ORANGE,string);
        GivePlayerMoney(killerid, 1000);
    }
    if(KillingSpree[killerid] == 9)
    {
        format(string,sizeof(string),"%s is on a killing spree with %d kills",pname,KillingSpree[killerid]);
        SendClientMessageToAll(COLOR_ORANGE,string);
        GivePlayerMoney(killerid, 1000);
    }
    if(KillingSpree[killerid] == 12)
    {
        //ect......
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)