Scripting Help [+Rep]
#1

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
Reply
#2

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;
}
Reply
#3

I thing this will not be good

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

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;
}
Reply
#5

This helped meee to mutch <3 Thank You

If i will use command again the SetPlayerPos will be updated ?
Reply
#6

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

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
Reply
#8

This not work something else
Reply
#9

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)