SA-MP Forums Archive
/surf command - 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: /surf command (/showthread.php?tid=160024)



/surf command - iggy1 - 15.07.2010

Hi, so i wanted to make a vip command /surf that loops through players to see if they are surfing the vehicle in question and removes them from it. Youll get a better idea of what i mean from the code (hopefully lol). It uses zcmd.

pawn Код:
COMMAND:surf(playerid,params[])
{
    if(IsPlayerVipMember(playerid))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            for(new i; i <= 49; i++)
            {
                if(GetPlayerSurfingVehicleID(i) == GetPlayerVehicleID(playerid))
                {
                    SetPlayerVelocity(i,0.3,0.0,0.3);
                }
            }
        }
        else return SendClientMessage(playerid,Lred,"Error You Are Not In A Vehicle");
    }
    else return SendClientMessage(playerid,Lred,"Error You Are Not Vip");
    return 1;
}
I tryed to keep it simple don't get why its not working. Btw the loop is 49 as the server its going on is set to 50 players.
Thanks in advance.


Re: /surf command - [DK]JaloNik - 15.07.2010

Is the funktion GetPlayerSurfingVehicleID one you've defined`?


Re: /surf command - Hiddos - 15.07.2010

Quote:
Originally Posted by [DK]JaloNik
Посмотреть сообщение
Is the funktion GetPlayerSurfingVehicleID one you've defined`?
/facepalm.
https://sampwiki.blast.hk/wiki/GetPlayerSurfingVehicleID

On-topic:
Do loop of 50, it starts with 0 and ends with 49.


What exactly isn't working? It doesn't throw them of the vehicle?


Re: /surf command - Finn - 15.07.2010

Quote:
Originally Posted by Hiddos
Посмотреть сообщение
On-topic:
Do loop of 50, it starts with 0 and ends with 49.
This also starts with 0 and ends with 49. <= 49 is the same as < 50.

pawn Код:
for(new i; i <= 49; i++)
Are you sure the bug is not in the IsPlayerVipMember(playerid) function?

If it works fine, try setting bigger velocity values and see what happens.


Re: /surf command - iggy1 - 15.07.2010

The vip function works fine. And yes the problem is it isn't throwing them off the vehicle and the loop should be fine as when it hits 49 thats the 50th playerid (i know this could backfire but we dont get 50players yet so for now its fine).
So do you think i should setplayerpos or something? for me i cant understand why its not working.
The vip function is supplied with LuxAdmin and is tested on many other FS ive made.

Someone have an ideas? Thanks in advance.


Re: /surf command - Finn - 15.07.2010

Yeah the problem is in the SA-MP's surfing code, it doesn't want to let the player fall from the vehicle's roof. Try SetPlayerPos, maybe that'll work. Or freeze the player for some seconds.


Re: /surf command - iggy1 - 15.07.2010

Ok thanks finn ill try that cant test for a couple of hours so if anyone else has any ideas id be greatfull.