01.02.2011, 20:17
Money doubles when I die (Only on death)
Ex: I have 5000
I die and now I have 10000
GameMode: OnPlayerSpawn
Filterscript:Admin/Register
GameMode OnPlayerDeath
Filterscript-Register/Admin OnPlayerDeath
Ex: I have 5000
I die and now I have 10000
GameMode: OnPlayerSpawn
pawn Код:
public OnPlayerSpawn(playerid)
{
SetPlayerHealth(playerid, 100.0);
SetPlayerArmour(playerid,100);
PlayerPlaySound(playerid, 1184, 0.0, 0.0, 0.0);
SetPlayerPos(playerid, 1808.8795,-1599.4998,13.5469);
GameTextForPlayer(playerid, "", 1, 3);
PlayerInfo[playerid][Spawned] = true;
SetPlayerVirtualWorld(playerid, 0);
SetPlayerInterior(playerid, 0);
gettime(hour, minute);
SetPlayerTime(playerid,hour,minute);
PlayerInfo[playerid][CriminalLevel] = 0;
SetPlayerWantedLevel(playerid, 0);
if(IsPlayerNPC(playerid))
{
new Text3D:Bot = Create3DTextLabel("lol_bot", COLOR_ORANGE, 0.0, 0.0, 0.0, 50.0, 0, 0);
Attach3DTextLabelToPlayer(Bot, 0, 0, 0, 0.2);
if(playerid==lol_bot)
{
PlayerInfo[0][Team] = TEAM_POLICE;
}
}
new string[128];
format(string, 128, "Script Version: %s Last Updated: %s", SCRIPT_VERSION, SCRIPT_UPDATED);
SendClientMessage(playerid, COLOR_YELLOW, string);
if(PlayerInfo[playerid][JailTime] != 0)
{
if(PlayerInfo[playerid][Arrested] == 1)
{
SetPlayerPos(playerid, 227.2460,109.7719,999.0156);
SetPlayerInterior(playerid, 10);
SetPlayerVirtualWorld(playerid, 5);
SendClientMessage(playerid, COLOR_GREEN, "Your jail sentence is not over. You will be sent free after your time is complete.");
format(string, 128, "If you dont want to stay in jail, you can pay your bail by typing '/paybail'. Your bail price is: $%d", PlayerInfo[playerid][BailPrice]);
SendClientMessage(playerid, COLOR_GREEN, string);
SetPlayerHealth(playerid, 9999999);
return 0;
}
else if(PlayerInfo[playerid][Arrested] == 2)
{
SetPlayerPos(playerid, 215.0472,110.0213,999.0156);
SetPlayerInterior(playerid, 10);
SetPlayerVirtualWorld(playerid, 1337);
SendClientMessage(playerid, COLOR_GREEN, "Your prison sentence is not over. You will be sent free after your time is complete.");
return 0;
}
}
if(PlayerInfo[playerid][AjailTime] != 0)
{
GameTextForPlayer(playerid, "~b~Ajail time is not over!", 3000, 3);
SetPlayerPos(playerid, 0.0, 0.0, 0.0);
TogglePlayerControllable(playerid, 0);
SetPlayerVirtualWorld(playerid, playerid);
return 0;
}
switch(PlayerInfo[playerid][Team])
{
case 0,1:
{
new position = random(sizeof(CopSpawn));
SetPlayerPos(playerid, CopSpawn[spawn][SpawnX], CopSpawn[spawn][SpawnY], CopSpawn[spawn][SpawnZ]);
GivePlayerWeapon(playerid, 24, 200); GivePlayerWeapon(playerid, 29, 150); GivePlayerWeapon(playerid, 25, 200);
SetPlayerArmour(playerid, 30);
SendClientMessage(playerid, COLOR_WHITE, "You are in the law enforcment. Your job is to protect the city of criminals.");
SendClientMessage(playerid, COLOR_WHITE, "TIP: If you need help, type /help and /commands. If you see a hacker or rulebreaker, use /report.");
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw01]);
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw11]);
TextDrawSetString(PlayerInfo[playerid][Textdraw11], "~b~Police");
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw21]);
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw31]);
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw41]);
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw51]);
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw61]);
TextDrawSetString(PlayerInfo[playerid][Textdraw61], "For ~g~help~w~, type ~g~/help~w~. For a list of ~g~commands~w~, type ~g~commands~w~.");
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw71]);
SetTimerEx("cleartext", 8000, 0, "u", playerid);
if(playerid!=0)Iter_Add(Cops, playerid);
}
case 2: //swat
{
SetPlayerPos(playerid, 759.4473,-1363.1069,13.5181);
GivePlayerWeapon(playerid, 24, 200); GivePlayerWeapon(playerid, 31, 250); GivePlayerWeapon(playerid, 27, 50);
SetPlayerArmour(playerid, 100);
SendClientMessage(playerid, COLOR_WHITE, "You are in the law enforcment. Your job is to protect the city of criminals.");
SendClientMessage(playerid, COLOR_WHITE, "TIP: If you need help, type /help and /commands. If you see a hacker or rulebreaker, use /report.");
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw01]);
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw11]);
TextDrawSetString(PlayerInfo[playerid][Textdraw11], "~b~S.W.A.T");
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw21]);
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw31]);
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw41]);
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw51]);
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw61]);
TextDrawSetString(PlayerInfo[playerid][Textdraw61], "For ~g~help~w~, type ~g~/help~w~. For a list of ~g~commands~w~, type ~g~commands~w~.");
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw71]);
SetTimerEx("cleartext", 8000, 0, "u", playerid);
if(playerid!=0)Iter_Add(Cops, playerid);
}
case 3: //national guard
{
SetPlayerPos(playerid, 2749.4026,-2447.4622,13.6484);
GivePlayerWeapon(playerid, 29, 200); GivePlayerWeapon(playerid, 31, 250); GivePlayerWeapon(playerid, 27, 80);
SetPlayerArmour(playerid, 100);
SendClientMessage(playerid, COLOR_WHITE, "You are in the law enforcment. Your job is to protect the city of criminals.");
SendClientMessage(playerid, COLOR_WHITE, "TIP: If you need help, type /help and /commands. If you see a hacker or rulebreaker, use /report.");
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw01]);
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw11]);
TextDrawSetString(PlayerInfo[playerid][Textdraw11], "~b~National Guard");
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw21]);
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw31]);
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw41]);
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw51]);
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw61]);
TextDrawSetString(PlayerInfo[playerid][Textdraw61], "For ~g~help~w~, type ~g~/help~w~. For a list of ~g~commands~w~, type ~g~commands~w~.");
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw71]);
SetTimerEx("cleartext", 8000, 0, "u", playerid);
if(playerid!=0) Iter_Add(Cops, playerid);
}
case 4: //ems / fd
{
new position = random(sizeof(MedicSpawn));
SetPlayerPos(playerid, MedicSpawn[spawn][SpawnX], MedicSpawn[spawn][SpawnY], MedicSpawn[spawn][SpawnZ]);
GivePlayerWeapon(playerid, 23, 200);
if(GetPlayerSkin(playerid) == EmergencySkins[0] || GetPlayerSkin(playerid) == EmergencySkins[1])
{
SetPlayerPos(playerid, 1798.0996,-1703.1829,13.5297);
GivePlayerWeapon(playerid, 23, 200);
GivePlayerWeapon(playerid, 42, 500);
}
SetPlayerArmour(playerid, 25);
SendClientMessage(playerid, COLOR_WHITE, "You are an emergency responder. Your job is to help people in need.");
SendClientMessage(playerid, COLOR_WHITE, "TIP: If you need help, type /help and /commands. If you see a hacker or rulebreaker, use /report.");
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw01]);
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw11]);
TextDrawSetString(PlayerInfo[playerid][Textdraw11], "~g~Emergency Responder");
//TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw21]);
//TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw31]);
//TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw41]);
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw51]);
TextDrawSetString(PlayerInfo[playerid][Textdraw51], "You are an ~g~responder~w~. Your job is to heal and save the lives of the people.");
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw61]);
TextDrawSetString(PlayerInfo[playerid][Textdraw61], "For ~g~help~w~, type ~g~/help~w~. For a list of ~g~commands~w~, type ~g~commands~w~.");
//TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw71]);
SetTimerEx("cleartext", 8000, 0, "u", playerid);
}
case 5:
{
new spawn = random(15);
SetPlayerPos(playerid, CivSpawns[spawn][SpawnX], CivSpawns[spawn][SpawnY], CivSpawns[spawn][SpawnZ]);
GivePlayerWeapon(playerid, 24, 150);
SendClientMessage(playerid, COLOR_WHITE, "You are a civilian. You can freeroam and do anything you want in the city.");
SendClientMessage(playerid, COLOR_WHITE, "TIP: If you need help, type /help and /commands. If you see a hacker or rulebreaker, use /report.");
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw01]);
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw11]);
TextDrawSetString(PlayerInfo[playerid][Textdraw11], "~w~Civilian");
//TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw21]);
//TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw31]);
//TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw41]);
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw51]);
TextDrawSetString(PlayerInfo[playerid][Textdraw51], "You are an ~w~civilian. You can freeroam and do anything in the city.~n~ Jobs are also scattered around the city.");
TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw61]);
TextDrawSetString(PlayerInfo[playerid][Textdraw61], "~n~For ~g~help~w~, type ~g~/help~w~. For a list of ~g~commands~w~, type ~g~commands~w~.");
//TextDrawShowForPlayer(playerid, PlayerInfo[playerid][Textdraw71]);
SetTimerEx("cleartext", 8000, 0, "u", playerid);
SetPlayerColor(playerid, COLOR_WHITE);
}
}
TextDrawShowForPlayer(playerid, WebURL);
new accountpath[64]; format(accountpath, 64, "%s", AccountPath(playerid));
if(dini_Int(accountpath, "donategun") != 0) GivePlayerWeapon(playerid, dini_Int(accountpath, "donategun"), 500);
if(dini_Int(accountpath, "donatearm") != 0) SetPlayerArmour(playerid, 100.0);
//SetPlayerHoldingObject(playerid, 355, 1, -0.14, -0.14, 0.0); //ak47 on back test
SetPlayerScore(playerid, PlayerInfo[playerid][CriminalSkill] + PlayerInfo[playerid][CopSkill]);
return 1;
}
Filterscript:Admin/Register
pawn Код:
public OnPlayerSpawn(playerid)
{
new file[128];
new name[MAX_PLAYER_NAME];
new string[128];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"/mRegistration/Users/%s.ini",name);
if(fexist(file))
{
Spawn[playerid]=1;
LoadStatus(playerid);
Spawn[playerid]=0;
}
format(file,sizeof(file),"/mRegistration/Settings/%s.ini",name);
if(fexist(file))
{
if(PlayerInfo[playerid][SavePosition] >= 1){
format(string, sizeof string, "{C9BBAF}Do you want to restore your position from last time ?");
ShowPlayerDialog(playerid,RestorPos ,DIALOG_STYLE_MSGBOX,"{509CC5}Restore Position?",string,"Yes","No");
}
if(PlayerInfo[playerid][SaveSkin] == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "{FFFFEB}Use {55B500}/saveskin{FFFFEB} to save your skin");
}else if(PlayerInfo[playerid][SaveSkin] >= 1){
SetPlayerSkin(playerid, dini_Int(file,"Skins"));
}
}
return 1;
}
GameMode OnPlayerDeath
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
GivePlayerMoney(playerid,-500-random(500));
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(IsPlayerCop(playerid)) Iter_Remove(Cops, playerid);
PlayerInfo[playerid][SessionKills] = 0;
if(IsPlayerCop(playerid))
{
for(new i=0; i < MAX_PLAYERS; i++)
{
if(WantedInfo[i][playerid][WantedZone] != 0)
{
GangZoneDestroy(WantedInfo[i][playerid][WantedZone]);
}
}
}
else if(PlayerInfo[playerid][CriminalLevel] > 1)
{
for(new i=0; i < MAX_PLAYERS; i++)
{
if(WantedInfo[playerid][i][WantedZone] != 0)
{
GangZoneDestroy(WantedInfo[playerid][i][WantedZone]);
TextDrawHideForPlayer(playerid, PlayerInfo[playerid][Textdraw0]);
}
}
}
new bool:send=true;
if(killerid != INVALID_PLAYER_ID)
{
if(IsPlayerCop(killerid))
{
if(PlayerInfo[playerid][CriminalLevel] >= 6)
{
GameTextForPlayer(killerid, "~b~You killed a wanted criminal~n~~r~+$5000", 3000, 3);
GivePlayerMoneyEx(killerid, 5000);
}
if(PlayerInfo[playerid][CriminalLevel] <= 1)
{
GameTextForPlayer(killerid, "~r~Dont kill white or yellow players~n~-$2000", 3000, 3);
GivePlayerMoneyEx(killerid, -2000);
send=false;
}
}
if(send)
{
PlayerInfo[killerid][SessionKills]++;
if(PlayerInfo[killerid][SessionKills] > 2)
{
new string[128];
format(string, 128, "~y~]~r~Killing Spree ~y~of ~r~%d Kills~y~]", PlayerInfo[killerid][SessionKills]);
GameTextForPlayer(killerid, string, 2000, 3);
}
}
PlayerInfo[killerid][Kills]++;
if(!IsPlayerCop(killerid))
{
if(PlayerInfo[killerid][Job] == 1)
{
for(new h=0; h < MAX_PLAYERS; h++)
{
if(Hits[h][0])
{
if(strfind(Hits[h],PlayerName(playerid),true) != -1)
{
new string[128];
format(string, 128, "CONTRACT: You killed %s, who had a contract placed on him for $%d.", PlayerName(playerid), PlayerInfo[playerid][HasHit]);
SendClientMessage(killerid, COLOR_GREEN, string);
SendClientMessage(playerid, COLOR_GREEN, "CONTRACT: You were killed for a hitman contract");
GivePlayerMoneyEx(killerid, PlayerInfo[playerid][HasHit]);
PlayerInfo[playerid][HasHit] = 0;
Hits[h]="9999";
}
}
}
}
IncreaseWantedLevel(killerid, 4);
SendClientMessage(killerid, COLOR_RED, "WANTED: You have commited first degree murder. Your wanted level has increased.");
}
TogglePlayerSpectating(playerid, 1);
if(IsPlayerInAnyVehicle(killerid))
{
PlayerSpectateVehicle(playerid, GetPlayerVehicleID(killerid));
}
else
{
PlayerSpectatePlayer(playerid, killerid);
}
SetTimerEx("stopspec", 10000, 0, "u", playerid);
new string[128];
format(string, 128, "~r~Killed by %s~n~~w~Spawning in ~r~10~w~seconds", PlayerName(killerid));
GameTextForPlayer(playerid, string, 3000, 3);
}
new playerweapons[13][2];
for(new i=0; i < 13; i++)
{
GetPlayerWeaponData(playerid, i, playerweapons[i][0], playerweapons[i][1]);
new Float:X=x+(random(3)-random(3));
new Float:Y=y+(random(3)-random(3));
new pickup;
switch(playerweapons[i][0])
{
case 22: { pickup=CreatePickup(346,1,X,Y,z); Iter_Add(WeapPickups,pickup); weapon[pickup]=22; weapontime[pickup]=10; }//, 0, 0, -1, 20.0);//. //colt
case 23: { pickup=CreatePickup(347,1,X,Y,z); Iter_Add(WeapPickups,pickup); weapon[pickup]=23; weapontime[pickup]=10; }//, 0, 0, -1, 20.0);//.
case 24: { pickup=CreatePickup(348,1,X,Y,z); Iter_Add(WeapPickups,pickup); weapon[pickup]=24; weapontime[pickup]=10; }//, 0, 0, -1, 20.0);//.
case 25: { pickup=CreatePickup(349,1,X,Y,z); Iter_Add(WeapPickups,pickup); weapon[pickup]=25; weapontime[pickup]=10; }//, 0, 0, -1, 20.0);//.
case 30: { pickup=CreatePickup(355,1,X,Y,z); Iter_Add(WeapPickups,pickup); weapon[pickup]=30; weapontime[pickup]=10; }//, 0, 0, -1, 20.0);//.
case 27: { pickup=CreatePickup(351,1,X,Y,z); Iter_Add(WeapPickups,pickup); weapon[pickup]=27; weapontime[pickup]=10; }//, 0, 0, -1, 20.0);//.
case 31: { pickup=CreatePickup(356,1,X,Y,z); Iter_Add(WeapPickups,pickup); weapon[pickup]=31; weapontime[pickup]=10; }//, 0, 0, -1, 20.0);//
case 34: { pickup=CreatePickup(358,1,X,Y,z); Iter_Add(WeapPickups,pickup); weapon[pickup]=34; weapontime[pickup]=10; }//, 0, 0, -1, 20.0);//
case 29: { pickup=CreatePickup(353,1,X,Y,z); Iter_Add(WeapPickups,pickup); weapon[pickup]=29; weapontime[pickup]=10; }//, 0, 0, -1, 20.0);//.
//346,347,348,349,351,353,355,356,358
}
}
TextDrawHideForPlayer(playerid,txtTimeDisp);
SendDeathMessage(killerid, playerid, reason);
PlayerInfo[playerid][Deaths]++;
PlayerInfo[playerid][Spawned] = false;
PlayerInfo[playerid][CriminalLevel] = 0;
SetPlayerWantedLevel(playerid, 0);
if(!IsPlayerCop(playerid)) SetPlayerColor(playerid, COLOR_WHITE);
for(new i=0; i < 14; i++)
{
PlayerCrimes[playerid][i] = 9999;
}
DataSaveForPlayer(playerid);
return 1;
}
Filterscript-Register/Admin OnPlayerDeath
pawn Код:
public OnPlayerDeath(playerid, killerid)
{
new file[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"/mRegistration/Users/%s.ini",name);
if(fexist(file)){
dini_Create(file);
dini_IntSet(file,"Score", GetPlayerScore(playerid));
dini_IntSet(file,"Money", GetPlayerMoney(playerid));
GetPlayerPos(playerid,x,y,z);
PlayerInfo[playerid][posx] = x;
PlayerInfo[playerid][posy] = y;
PlayerInfo[playerid][posz] = z;
dini_FloatSet(file,"posx", PlayerInfo[playerid][posx]);
dini_FloatSet(file,"posy", PlayerInfo[playerid][posy]);
dini_FloatSet(file,"posz", PlayerInfo[playerid][posz]);
PlayerInfo[playerid][Deaths] ++;
PlayerInfo[killerid][Kills] ++;
}
return 1;
}