I've scripting for 2 years from now and i still don't know what i need to know about pickups.
PROBLEM: when player pickups bomb pickup it activates bomb pickup and surprise pickup. The same goes other way - when i pickup surprise pickup it activates surprise pickup and bomb pickup (but not fully).
P.s. if you need to translate this script in to english, reply that in the comments.
Код:
public OnGameModeInit()
{
SetTimer("BombuPickupRespawn",10*60*1000,true);
SetTimer("OnSurpriseSpawn",4*60*1000,true);
}
public OnSurpriseSpawn()
{
if(OnlinePlayers > 1)
{
DestroyDynamicPickup(surprise);
DestroyDynamicObject(surprisebox);
new Random = random(sizeof(RandomSurpriseSpawns));
surprise = CreateDynamicPickup(1279,2,RandomSurpriseSpawns[Random][0],RandomSurpriseSpawns[Random][1],RandomSurpriseSpawns[Random][2]);
surprisebox = CreateDynamicObject(1558,RandomSurpriseSpawns[Random][0],RandomSurpriseSpawns[Random][1],RandomSurpriseSpawns[Random][2],0,0,RandomSurpriseSpawns[Random][3],0,0);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(zaidejas[i][zona] == 0)
{
if(IsPlayerConnected(i))
{
SetPlayerMapIcon(i,3,RandomSurpriseSpawns[Random][0],RandomSurpriseSpawns[Random][1],RandomSurpriseSpawns[Random][2],0,0x00FF00FF);
GameTextForPlayer(i,"Aptikta ~g~dovana ~w~radare!",3000,5);
}
}
}
}
return 1;
}
public BombuPickupRespawn()
{
DestroyDynamicPickup(BVBomba);
DestroyDynamicPickup(JVBomba);
BVBomba = CreateDynamicPickup(1252,2,1045.8867,2149.7009,1001.1385,2,6);
JVBomba = CreateDynamicPickup(1252,2,398.3667,128.5666,1012.9420,2,6);
return 1;
}
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
if(pickupid == BVBomba)
{
if(gTeam[playerid] == baltieji)
{
TJBomba[playerid] = 1;
DestroyDynamicPickup(BVBomba);
for(new i;i<MAX_PLAYERS;i++)
{
if(zaidejas[i][zona] == 0)
{
SendClientMessage(i,-1,"{FFFFFF}- Raudonosios Mafijos vartams bomba buvo paimta.");
}
}
}
else SendClientMessage(playerid,-1,"{FF0000}!!! {FFFFFF}Zadi sprogdinti savo mafijos vartus? Ne, ne, ne, ne.");
}
if(pickupid == JVBomba)
{
if(gTeam[playerid] == juodieji)
{
TBBomba[playerid] = 1;
DestroyDynamicPickup(JVBomba);
for(new i;i<MAX_PLAYERS;i++)
{
if(zaidejas[i][zona] == 0)
{
SendClientMessage(i,-1,"{FFFFFF}- Melynosios Mafijos vartams bomba buvo paimta.");
}
}
}
else SendClientMessage(playerid,-1,"{FF0000}!!! {FFFFFF}Zadi sprogdinti savo mafijos vartus? Ne, ne, ne, ne.");
}
if(pickupid == surprise)
{
new string[50],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
DestroyDynamicPickup(surprise);
DestroyDynamicObject(surprisebox);
zaidejas[playerid][dovana]++;
new Gift = random(12);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
format(string,sizeof(string),"~w~Dovana pasieme~n~~r~%s",name);
GameTextForAll(string,3000,6);
RemovePlayerMapIcon(i,3);
}
}
switch(Gift)
{
case 0:
{
GivePlayerMoney(playerid,30000);
zaidejas[playerid][pinigai]= GetPlayerMoney(playerid);
GivePlayerWeapon(playerid,WEAPON_ROCKETLAUNCHER,20);
SetPlayerScore(playerid,GetPlayerScore(playerid)+20);
zaidejas[playerid][patirtis] = GetPlayerScore(playerid);
SendClientMessage(playerid,-1,"- Gavai {00FF00}$30000{FFFFFF}, {0000FF}20 {FFFFFF}patirties ir {FF0000}Raketsvaidi su 20 raketu.");
}
case 1:
{
SetPlayerHealth(playerid,0);
SendClientMessage(playerid,-1,"- Radai aleksyra ir iskart isgerei neperskaites zodzio {FF0000}<nuodai>");
}
case 2:
{
GivePlayerWeapon(playerid,WEAPON_AK47,100);
GivePlayerWeapon(playerid,WEAPON_GRENADE,20);
GivePlayerWeapon(playerid,WEAPON_SNIPER,20);
GivePlayerWeapon(playerid,WEAPON_DEAGLE,100);
GivePlayerWeapon(playerid,WEAPON_SHOTGUN,100);
SendClientMessage(playerid,-1,"- Sveikiname, gavai visus {FF0000}kilerio inventoriaus ginklus{FFFFFF}!");
}
case 3:
{
new Float:x, Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
SPD(playerid,SURPRISE,DIALOG_STYLE_LIST,"SULANKSTYTAS TRANSPORTAS","Infernus\nNRG-500\nHYDRA","Rinktis","Iseiti");
SendClientMessage(playerid,-1,"- Wow! Dezeje buvo surastas {00FF00}<Vienkartinis Sulankstytas Transportas>");
}
}
}
return 1;
}