SA-MP Forums Archive
[help] spawn in certain area - 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] spawn in certain area (/showthread.php?tid=89194)



[help] spawn in certain area - mr.b - 31.07.2009

hello i need some help with this please

i am creating a dm zone but I want when a player die spawn in dm zone again

how can do that?

here is the code
Код:
new InDM1[MAX_PLAYERS];
new Float:ppos[MAX_PLAYERS][3];
new Float:RandomSpawnsDM1[4][4] = {
{-1447.3282,1502.1755,1.7366,201.0638},
{-1401.4185,1484.7222,7.1016,348.6452},
{-1378.2351,1484.8160,16.3203,311.0449},
{-1391.6136,1489.3990,1.8672,341.4618}
};
Код:
new RandomWeapons[4] = {
24,
27,
31,
9
};
Код:
if(strcmp(cmdtext,"/dm",true)==0)
{
if(InDM1[playerid]!=1)
{
InDM1[playerid]++;
SendClientMessage(playerid,COLOR_GREEN,"Welcome to DM Zone!");
new rand = random(sizeof(RandomSpawnsDM1));
SetPlayerPos(playerid,RandomSpawnsDM1[rand][0],RandomSpawnsDM1[rand][1],RandomSpawnsDM1[rand][2]);
SetPlayerFacingAngle(playerid,RandomSpawnsDM1[rand][3]);
GetPlayerPos(playerid,ppos[playerid][0],ppos[playerid][1],ppos[playerid][2]);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid,RandomWeapons[rand],500);
}
else
{
SendClientMessage(playerid,COLOR_RED,"you are already in dm!");
return 1;
}
return 1;
}
Код:
if(strcmp(cmdtext,"/exitdm",true)==0)
{
if(InDM1[playerid]==1)
{
SetPlayerPos(playerid,ppos[playerid][0],ppos[playerid][1],ppos[playerid][2]);
InDM1[playerid]--;
SendClientMessage(playerid,COLOR_LIGHTBLUE,"you left of dm");
}
else
{
SendClientMessage(playerid,COLOR_RED,"you are not in any dm!");
return 1;
}
return 1;
}
sorry for my bad english


Re: [help] spawn in certain area - MadeMan - 31.07.2009

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(InDM1[playerid] == 1)
    {
        new rand = random(sizeof(RandomSpawnsDM1));
        SetPlayerPos(playerid,RandomSpawnsDM1[rand][0],RandomSpawnsDM1[rand][1],RandomSpawnsDM1[rand][2]);
        SetPlayerFacingAngle(playerid,RandomSpawnsDM1[rand][3]);
        ResetPlayerWeapons(playerid);
        GivePlayerWeapon(playerid,RandomWeapons[rand],500);
    }
    return 1;
}



Re: [help] spawn in certain area - mr.b - 31.07.2009

thanks