SA-MP Forums Archive
Help with random 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 with random spawn (/showthread.php?tid=226862)



Help with random spawn - Gotti_ - 16.02.2011

I have something like this


if (strcmp("//shermandm", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid, -688.5651,2094.6106,925.0209);
GameTextForPlayer(playerid,"~y~Sherman DeathMatch~r~ by MosQ and Eset",3000,4);
SetPlayerArmour(playerid, 0);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 24, 999);

return 1;
}


But i want to make 2 spawns, not one, so it can be something like team deathmatch, can you help me please ?

... if you can please make me here 2 spawns (random), ill edit coordinates..

tnx


AW: Help with random spawn - Nero_3D - 16.02.2011

thats not hard

pawn Код:
if (strcmp("/shermandm", cmdtext, true, 11) == 0)
{
    switch(random(2))
    {
        case 0: SetPlayerPos(playerid, -688.5651,2094.6106,925.0209);
        case 1: SetPlayerPos(playerid, -688.5651,2094.6106,925.0209);
    }
    GameTextForPlayer(playerid, "~y~Sherman DeathMatch~r~  by MosQ and Eset", 3000, 4);
    SetPlayerArmour(playerid, 0);
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid, 24, 999);
    return 1;
}
Nothing more


Re: Help with random spawn - Gotti_ - 16.02.2011

ok tnx.. just one more question,

how to add there SetPlayerColor

i want 2 random colors because its tdm


AW: Re: Help with random spawn - Nero_3D - 16.02.2011

Quote:
Originally Posted by Gotti_
Посмотреть сообщение
ok tnx.. just one more question,

how to add there SetPlayerColor

i want 2 random colors because its tdm
You just need brackets

pawn Код:
switch(random(2))
{
    case 0:
    {
        SetPlayerColor(playerid, 0xFFFFFFFF);
        SetPlayerPos(playerid, -688.5651,2094.6106,925.0209);
    }
    case 1:
    {
        SetPlayerColor(playerid, 0xFFFFFFFF);
        SetPlayerPos(playerid, -688.5651,2094.6106,925.0209);
    }
}



Re: Help with random spawn - Gotti_ - 16.02.2011

thanks a lot !


Re: Help with random spawn - Jochemd - 16.02.2011

Actually you don't really need brackets

pawn Код:
if (strcmp("/shermandm", cmdtext, true, 11) == 0)
{
    switch(random(2))
    {
        case 0: SetPlayerPos(playerid, -688.5651,2094.6106,925.0209) && SetPlayerColor(playerid,blah);
        case 1: SetPlayerPos(playerid, -688.5651,2094.6106,925.0209) && SetPlayerColor(playerid,blah);
    }
    GameTextForPlayer(playerid, "~y~Sherman DeathMatch~r~  by MosQ and Eset", 3000, 4);
    SetPlayerArmour(playerid, 0);
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid, 24, 999);
    return 1;
}