if a player dies, his cash will be increased?
#1

Hello guys! so there is a problem in my script when a player get spawned or killed and when he spawns his money is getting increased not decreased can someone tell me what the causes of it?
Reply
#2

Yeah, i think it's because the course of the Earth is slighty changing, causing little problems in the matrix.

Or so I guess, it'd be better if you show your OnPlayerDeath and OnPlayerSpawn, though.
Reply
#3

PHP код:
public OnPlayerSpawn(playerid)
{
    if(
GetPlayerTeam(playerid) == TEAM_COPS)
    {
        
SetPlayerColor(playerid0x0000FFFF);
        
SetPlayerHealth(playerid100);
        
SetPlayerPos(playerid, -1616.7162,681.8493,7.1875);
        
SendClientMessage(playerid0xf8f8f8fff"-SpawnInfo- {Ffffff}You been spawned as {000375}Cop! {FFFFFF}Type {000375}/pcmds {FFFFFF}to get Police's Commands.");
        
SendClientMessage(playerid0xf8f8f8fff"-Info- {Ffffff}Go get some freaking {3af75b}Racers!");
        
GivePlayerWeapon(playerid24500);
        
GivePlayerWeapon(playerid25500);
        
GivePlayerWeapon(playerid28500);
    }
    else if(
GetPlayerTeam(playerid) == TEAM_RACERS)
    {
        
SetPlayerColor(playerid0x800000FF);
        
SetPlayerHealth(playerid100);
        
SetPlayerPos(playerid, -2634.1814,1360.3250,9.0281);
        
SendClientMessage(playerid0xf8f8f8fff"-SpawnInfo- {Ffffff}You been spawned as {3af75b}Racer! {FFFFFF}Type {000375}/rcmds {FFFFFF}to get Robber's Commands.");
        
SendClientMessage(playerid0xf8f8f8fff"-Info- {Ffffff}Go get some freaking {000375}Cops!");
        
GivePlayerWeapon(playerid24,500);
        
GivePlayerWeapon(playerid28,500);
        
GivePlayerWeapon(playerid20,500);
    }
    if(
GetPlayerTeam(playerid) == TEAM_VIP)
    {
        if(
PlayerInfo[playerid][pVIP] >= 1)
        {
        
SetPlayerColor(playerid0x00FFFFFF);
        
SetPlayerArmour(playerid100);
        
SetPlayerHealth(playerid100);
        
SetPlayerPos(playerid, -1495.7765,919.8442,7.1875);
        
SendClientMessage(playerid0xf8f8f8fff"-SpawnInfo- {Ffffff}You been spawned as {00CED1}V.I.P! {FFFFFF}Type {00CED1}/vipcmds {FFFFFF}to get V.I.P's Commands.");
        
SendClientMessage(playerid0xf8f8f8fff"-Info- {Ffffff}Go get some freaking {3af75b}Racers {FFFFFF}And {000375}Cops!");
        
GivePlayerWeapon(playerid24500);
        
GivePlayerWeapon(playerid26500);
        
GivePlayerWeapon(playerid28500);
        
GivePlayerWeapon(playerid34500);
        }
        else
        {
        
SendClientMessage(playerid0xf8f8f8fff,"ERROR: {FFFFFF}You can't spawn as VIP, if you didn't Donate to the server! Type /kill + F4 to change your Class!");
        }
    }
    
TextDrawShowForPlayer(playeridTextdraw0);
    
TextDrawShowForPlayer(playeridTextdraw1);
    
TextDrawShowForPlayer(playeridTextdraw2);
    
TextDrawShowForPlayer(playeridTextdraw3);
    
TextDrawShowForPlayer(playeridTextdraw6);
    
TextDrawShowForPlayer(playeridTextdraw7);
    
TextDrawShowForPlayer(playeridTextdraw5);
    
TextDrawShowForPlayer(playeridTextdraw4[playerid]);
    
TextDrawShowForPlayer(playeridTextdraw8[playerid]);
    
TextDrawShowForPlayer(playeridTextdraw9[playerid]);
    
TextDrawShowForPlayer(playeridTextdraw10[playerid]);
    
TextDrawShowForPlayer(playeridTextdraw11[playerid]);
    
TextDrawShowForPlayer(playeridTextdraw12[playerid]);
    
TextDrawShowForPlayer(playeridTextdraw13);
    return 
1;

PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
    if ( 
killerid != INVALID_PLAYER_ID // If the killerid are NOT an invalid player
    
// Then
        
new string[250]; new name[MAX_PLAYER_NAME]; new kname[MAX_PLAYER_NAME]; new weapon[128];
        
GetPlayerName(playeridname,sizeof(name));
        
GetPlayerName(killeridkname,sizeof(kname));
        
GetWeaponName(reasonweapon,sizeof(weapon));
        if ( 
GetPlayerTeamkillerid ) == GetPlayerTeamplayerid ) ) // If killerid's team == playerid's team ( who has been killed )
        
// Then
            
SetPlayerHealthkillerid); // Kills the killer ( Setting the health to -1 ).
            
GameTextForPlayer(killerid"!~R~TEAM-KILLING ~W~Isn't Allowed!",30000,6); // Sends a message to the killer with a white colour ( -1 ), with the message " No teamkilling. ".
            
GivePlayerMoneykillerid, -5000 ); // Take $5000 from the killerid, because teamkilling,
        
}
        else 
// Another team killed the player
        
{
            
GameTextForPlayer(killerid"!~R~NICE SHOT ~G~ $2000$ ~B~ +3SCORES!~W~!",3000,3); // Sends a message to the killer with a white colour ( -1 ) with the message "Nice Shot! ".
            
format(string,sizeof(string),"-DM- {F00f00}%s(%i) {ffffff}has killed {ff0ff0}%s(%i) {FFFFFF}and got {f44f44}3+ Scores {FFFFFF}& 2XP!",kname,killerid,name,playerid);
            
SendClientMessageToAll(0xf8f8f8fff,string);
            
GivePlayerMoney(killerid2000);
            
SetPlayerScore(killerid,GetPlayerScore(killerid)+3);
            
PlayerInfo[killerid][pKills] += 1;
            
PlayerInfo[playerid][pDeaths] += 1;
            
PlayerInfo[killerid][pXP] += 2;
            
PlayerInfo[killerid][pScore] += 3;
            
PlayerInfo[killerid][pCash] += 2000;
        }
    }
    
SendDeathMessage(  killeridplayeridreason );
return 
1;

EDIT: i have added GivePlayerMoney(playerid, pinfo....) and SetPlayerScore(playerid,pinfo....); under logging in
Reply
#4

FIXED FIXED FIXED!

SORRY FOR DOUBLE POSTING!

Resolution: You have to set GivePlayerMoney and SetPlayerScore Function under your Logging in dialog and it will work! thanks for helping me Tyodere
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)