Random Spawn in DM-s
#1

How i can make random spawns in DM
Код:
if (strcmp(cmdtext,"/area51dm", true, 9) ==0)
	{
	if(IsAtDMArea[playerid] == 1) return SendClientMessage(playerid, red, "You already are at dm area");
	if(IsAtDM[playerid] == 2) return GameTextForPlayer(playerid, "~r~/~w~exitdm", 2000, 5);
	if(IsAtDM[playerid] == 3) return GameTextForPlayer(playerid, "~r~/~w~exitdm", 2000, 5);
	if(IsAtDM[playerid] == 4) return GameTextForPlayer(playerid, "~r~/~w~exitdm", 2000, 5);
	if(IsAtDM[playerid] == 5) return GameTextForPlayer(playerid, "~r~/~w~exitdm", 2000, 5);
	if(IsAtDM[playerid] == 6) return GameTextForPlayer(playerid, "~r~/~w~exitdm", 2000, 5);
	if(IsAtDM[playerid] == 7) return GameTextForPlayer(playerid, "~r~/~w~exitdm", 2000, 5);
	if(IsAtDM[playerid] == 8) return GameTextForPlayer(playerid, "~r~/~w~exitdm", 2000, 5);
	SetPlayerPos(playerid,203.5948, 1929.7161, 22.8286);
	new str[128],name[24];
        GetPlayerName(playerid,name,24);
        format(str,sizeof(str),"~r~%s ~w~has teleported to /area51dm",name);
        TextDrawSetString(teleporttext,str);
	GivePlayerWeapon(playerid,24,100);//------Deagle
	GivePlayerWeapon(playerid,27,100);//------Combat Shotgun
	GivePlayerWeapon(playerid,34,100);//------Sniper Rifle
	TextDrawShowForAll(teleporttext);
	SendClientMessage(playerid,yellow,"Welcome To The Area51 Death match! to Exit use /exitdm!!!");
        dm1[playerid] = 1;
        IsAtDMArea[playerid] = 1;
        IsAtDM[playerid] = 1;
        SetTimerEx("HIDE_TELEPORT_TD", 9000, 0, "d", playerid);
	return 1;
}
Reply
#2

To make random spawns follow these instructions.
Requirements - Basic Knowledge of where to paste things, SA:MP Server Files, A script Editor, Brain :P
Lets start
First of all paste this on top of your script..i mean outside any callback
pawn Код:
new Float:DMSpawns[][4] =
{
    {X,Y,Z, Angle(this is important)},
    {X,Y,Z, Angle(this is important)},
    {X,Y,Z, Angle(this is important)},
    //continue adding more if you want..
    //NOTE - in the last spawn location, instead of comma(,) in the end put nothing.
};
Now change your command to
pawn Код:
if (strcmp(cmdtext,"/area51dm", true, 9) ==0)
    {
    if(IsAtDMArea[playerid] == 1) return SendClientMessage(playerid, red, "You already are at dm area");
    if(IsAtDM[playerid] == 2) return GameTextForPlayer(playerid, "~r~/~w~exitdm", 2000, 5);
    if(IsAtDM[playerid] == 3) return GameTextForPlayer(playerid, "~r~/~w~exitdm", 2000, 5);
    if(IsAtDM[playerid] == 4) return GameTextForPlayer(playerid, "~r~/~w~exitdm", 2000, 5);
    if(IsAtDM[playerid] == 5) return GameTextForPlayer(playerid, "~r~/~w~exitdm", 2000, 5);
    if(IsAtDM[playerid] == 6) return GameTextForPlayer(playerid, "~r~/~w~exitdm", 2000, 5);
    if(IsAtDM[playerid] == 7) return GameTextForPlayer(playerid, "~r~/~w~exitdm", 2000, 5);
    if(IsAtDM[playerid] == 8) return GameTextForPlayer(playerid, "~r~/~w~exitdm", 2000, 5);
    new rand = random(sizeof(DMSpawns));
        SetPlayerPos(playerid,DMSpawns[rand][0], DMSpawns[rand][1],DMSpawns[rand][2]);
        SetPlayerFacingAngle(playerid,DMSpawns[rand][3]);
    new str[128],name[24];
        GetPlayerName(playerid,name,24);
        format(str,sizeof(str),"~r~%s ~w~has teleported to /area51dm",name);
        TextDrawSetString(teleporttext,str);
    GivePlayerWeapon(playerid,24,100);//------Deagle
    GivePlayerWeapon(playerid,27,100);//------Combat Shotgun
    GivePlayerWeapon(playerid,34,100);//------Sniper Rifle
    TextDrawShowForAll(teleporttext);
    SendClientMessage(playerid,yellow,"Welcome To The Area51 Death match! to Exit use /exitdm!!!");
        dm1[playerid] = 1;
        IsAtDMArea[playerid] = 1;
        IsAtDM[playerid] = 1;
        SetTimerEx("HIDE_TELEPORT_TD", 9000, 0, "d", playerid);
    return 1;
}
Thank You!
Hope you understood.
Reply
#3

dont worry i understand all but i need to add new cords and everything for other dms? i have 8 of them
Reply
#4

Quote:
Originally Posted by Beljulji
Посмотреть сообщение
dont worry i understand all but i need to add new cords and everything for other dms? i have 8 of them
You don't unless you want them to spawn at a different location. Just Call the function holding the cords.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)