SA-MP Forums Archive
[HELP]Message when an object spawn. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP]Message when an object spawn. (/showthread.php?tid=215948)



[HELP]Message when an object spawn. - Nano_UY - 24.01.2011

Hi ppl from SA-MP help me with this!

Ok what i need help with:
Im trying to create a fs where a pickup randomy spawns and if a player get it he earns 50k. Thats not the problem, the problem is that I want the fs to announce on public chat for example: "The moneybag has spawned in Foster Valley" so the players know there is a mb and they know where to get it. But ive done everything, and it just doesen't say the msg, ill hand you the fs so you can help me.

http://pastebin.com/BUie6XQB

If there's anything you don't undertand let me know and I'll try to explain it better.


Re: [HELP]Message when an object spawn. - SkizzoTrick - 24.01.2011

First,you need the zones,second you need to create a timer that moves the pickup
Third,just attach a message to that timer so when the pickup moves it will automessage the players


Re: [HELP]Message when an object spawn. - Nano_UY - 24.01.2011

how can i do that pls help im noob


Re: [HELP]Message when an object spawn. - SkizzoTrick - 24.01.2011

do something like:

NOTE:You need the zone names,you can get them from here
https://sampforum.blast.hk/showthread.php?tid=27598

pawn Код:
//BEGINNING OF SCRIPT
new Float:SPSPawns[][3] = {
{-2225.3716,2326.9734,7.5469},
{-2747.8416,-315.7603,7.1952} };

stock GetPos2DZone(x,y,z, zone[], len)
{
        for(new i = 0; i != sizeof(gSAZones); i++ )
        {
                if(x >= gSAZones[i][SAZONE_AREA][0] && x <= gSAZones[i][SAZONE_AREA][3] && y >= gSAZones[i][SAZONE_AREA][1] && y <= gSAZones[i][SAZONE_AREA][4])
                {
                    return format(zone, len, gSAZones[i][SAZONE_NAME], 0);
                }
        }
        return 0;
}

public OnGameModeInit()
{
   SetTimer("ChangePickup",50000,1);//Put here the time between pickup position change
   return 1;
}

public ChangePickup();
{
     new rand = random(sizeof(SPSPawns));
     new zone[MAX_ZONE_NAME];
     new string[128];
     CreatePickup (1274,2,SPSPawns[rand][0], SPSPawns[rand][1], SPSPawns[rand][2])
     GetPos2DZone(SPSPawns[rand][0], SPSPawns[rand][1], SPSPawns[rand][2],zone,sizeof(zone));
     format(string,sizeof(string),"The pickup has spawned in %s",zone);
     SendClientMessageToAll(COLOR_WHITE,string);
     return 1;
}
I've tried to create a stock that gets the area by the pos,i didn't test it out but i hope it's working .
I told you what you need,what to do,now i guess it is gonna work xD
If it doesn't work,ill try to get some free time and make it by myself directly in your script cuz i made it in 1 minute now because im tired and i need to sleep xD

NOTE:You need to combine the Zone Name Fs with your GM!


Re: [HELP]Message when an object spawn. - Nano_UY - 31.01.2011

Pawno crashes when I try that, any other help? pls!


Re: [HELP]Message when an object spawn. - Nano_UY - 01.02.2011

pls i really need help with it


Re: [HELP]Message when an object spawn. - Nano_UY - 02.02.2011

HELP ME PLS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1111111 I dont know what to do! pls im noob with this of scritping and really need ur help!


Re: [HELP]Message when an object spawn. - Nano_UY - 04.02.2011

PLEASE! WHY dont u answer??