SA-MP Forums Archive
Goto, Get Here - 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: Goto, Get Here (/showthread.php?tid=211240)



Goto, Get Here - Larsey123IsMe - 14.01.2011

If i am in a vehicle then i do, /goto, then the vehicle should follow me witch it dosent.. same with "Get Here"

Anyone who can FIX it?

Goto
pawn Код:
SetPlayerInterior(playerid, GetPlayerInterior(targetid));
SetPlayerVirtualWorld(targetid,GetPlayerVirtualWorld(playerid));
new Float:x, Float:y, Float:z;
GetPlayerPos(targetid, x,y,z);
SetPlayerPos(playerid, x+1,y,z);
Get Here
pawn Код:
SetPlayerInterior(playerid, GetPlayerInterior(targetid));
SetPlayerVirtualWorld(targetid,GetPlayerVirtualWorld(playerid));
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x,y,z);
SetPlayerPos(targetid, x+1,y,z);
And O.o Why dosend this work =/ (im using a dialog)

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
    {
        format(string, sizeof(string), "Server admin have killed evryone, Muwhaha");
        SendClientMessageToAll(COLOR_ADMIN, string);

        SetPlayerHealth(i, 0);
        return 1;
    }



Re: Goto, Get Here - Backwardsman97 - 14.01.2011

Here's your goto with vehicle stuff.

pawn Код:
new
    Float:x,
    Float:y,
    Float:z,
    vehid = GetPlayerVehicleID(playerid),
    interior = GetPlayerInterior(targetid),
    world = GetPlayerVirtualWorld(targetid);
   
GetPlayerPos(targetid, x,y,z);
SetPlayerInterior(playerid, GetPlayerInterior(targetid));
SetPlayerVirtualWorld(targetid,GetPlayerVirtualWorld(playerid));

if(vehid)
{
    SetVehiclePos(vehid,x+1,y,z+3);
    LinkVehicleToInterior(vehid,interior);
    SetVehicleVirtualWorld(vehid,world);
    return 1;
}
else
{
    SetPlayerPos(playerid, x+1,y,z);
    return 1;
}
Just reverse the playerid's with the targetid's and vice versa.


Re: Goto, Get Here - Larsey123IsMe - 14.01.2011

THANK YOU

But O.o why dosent this work?

pawn Код:
if(listitem == 24)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        format(string, sizeof(string), Server admin have killed evryone, Muwhaha");
        SendClientMessageToAll(COLOR_ADMIN, string);

        SetPlayerHealth(i, 0);
        return 1;
    }
}



Re: Goto, Get Here - Backwardsman97 - 14.01.2011

pawn Код:
if(listitem == 24)
{
    SendClientMessageToAll(COLOR_ADMIN, "Server admin have killed evryone, Muwhaha");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        SetPlayerHealth(i, 0);
    }
    return 1;
}
Several things wrong with it. First of all it spams everybody every time it kills someone. Secondly, there's no need to format the message. Thirdly, and the actual reason it doesn't work, is because you returned 1 inside the loop. You only return something inside a loop when you want to end it. The way you had it, the loop closed after the first iteration. If it doesn't work now, it's because the listitem isn't 24.


Re: Goto, Get Here - Larsey123IsMe - 14.01.2011

Quote:
Originally Posted by Backwardsman97
Посмотреть сообщение
pawn Код:
if(listitem == 24)
{
    SendClientMessageToAll(COLOR_ADMIN, "Server admin have killed evryone, Muwhaha");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        SetPlayerHealth(i, 0);
    }
    return 1;
}
Several things wrong with it. First of all it spams everybody every time it kills someone. Secondly, there's no need to format the message. Thirdly, and the actual reason it doesn't work, is because you returned 1 inside the loop. You only return something inside a loop when you want to end it. The way you had it, the loop closed after the first iteration. If it doesn't work now, it's because the listitem isn't 24.
Awww, Awesome man Thanks