SA-MP Forums Archive
Scripting Help [+Rep] - 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)
+--- Thread: Scripting Help [+Rep] (/showthread.php?tid=552661)



Scripting Help [+Rep] - arlindi - 25.12.2014

Hello i need to crate a command /setspawn in cordinates where i amm
and next spawn he will spawn all players in cordinates where i used command /setspawn

So in game spawn creator


Re: Scripting Help [+Rep] - CachorroDoDavyJones - 25.12.2014

pawn Код:
new Float:Pos[MAX_PLAYERS][3];


for(new i=0; i <= MAX_PLAYERS; i++) { // Default spawn
    Pos[i][0] = 1422.1416;
    Pos[i][1] = -879.5490;
    Pos[i][2] = 50.1716.
}

CMD:setspawn(playerid, params[]) {
    #pragma unused params
    new Float:pos[3];
    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    for(new i=0; i < 3; i++) {
        Pos[playerid][i] = pos[i];
    }
}

public OnPlayerSpawn(playerid) {
    SetPlayerPos(playerid, Pos[playerid][0], Pos[playerid][1], Pos[playerid][2]);
    return 1;
}



Re: Scripting Help [+Rep] - arlindi - 25.12.2014

I thing this will not be good

I need just OnPlayerSpawn
SetPlayerPos to the command /setspawn where you do


Re: Scripting Help [+Rep] - HY - 25.12.2014

pawn Код:
enum sInfo
{
    Float:sX,
    Float:sY,
    Float:sZ
}
new SpawnInfo[MAX_PLAYERS][sInfo];

CMD:setspawn(playerid, params[])
{
    new Float:X, Float:Y, Float:Z;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}You are not authorized to use this command.");
    SendClientMessage(playerid, -1, "{FF0000}[INFO]: {FFFFFF}Spawn succesfully setted at this location.");
    GetPlayerPos(playerid, X, Y, Z);
    SpawnInfo[playerid][sX] = X;
    SpawnInfo[playerid][sY] = Y;
    SpawnInfo[playerid][sZ] = Z;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    SetPlayerPos(playerid, SpawnInfo[playerid][sX], SpawnInfo[playerid][sY], SpawnInfo[playerid][sZ]);
    return 1;
}



Re: Scripting Help [+Rep] - arlindi - 25.12.2014

This helped meee to mutch <3 Thank You

If i will use command again the SetPlayerPos will be updated ?


Re: Scripting Help [+Rep] - HY - 25.12.2014

Of course. When you /SetSpawn you will be spawned to the last position at /SetSpawn.


Re: Scripting Help [+Rep] - arlindi - 25.12.2014

Thank you bro i will rep you
Can give mee your skype name? I thing you will help mee too mutch with something else please


Re: Scripting Help [+Rep] - arlindi - 15.01.2015

This not work something else


Re: Scripting Help [+Rep] - Alex Magaсa - 15.01.2015

Have you included ZCMD? To make it work, i have seen that there are a lot of copypaste that not mention how to make a command works.

Try to download zcmd include if you don't have it.