[Help] OnPlayerUpdate with command????
#1

I made a command but I want it to be like this:
pawn Код:
public OnPlayerUpdate(playerid)
{
    new Float:cam1x;
    new Float:cam1y;
    new Float:cam1z;
   
    if (strcmp("/cam1", cmdtext, true, 10) == 0)
    {
        GetPlayerPos(playerid, cam1x, cam1y, cam1z);
        SetPlayerCameraPos(playerid, -2027.0925292969, -191.03739929199, 47.638492584229);
        SetPlayerCameraLookAt(playerid, cam1x, cam1y, cam1z);
        return 1;
    }
    return 1;
}
Any Ideas??
Reply
#2

I don't understand, explain your problem?
Reply
#3

You need to put your command in OnPlayerCommandText and not OnPlayerUpdate.

This callback [OnPlayerUpdate] is called everytime a client/player updates the server with their status.
Reply
#4

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new Float:cam1x;
    new Float:cam1y;
    new Float:cam1z;
   
    if (strcmp("/cam1", cmdtext, true, 10) == 0)
    {
        GetPlayerPos(playerid, cam1x, cam1y, cam1z);
        SetPlayerCameraPos(playerid, -2027.0925292969, -191.03739929199, 47.638492584229);
        SetPlayerCameraLookAt(playerid, cam1x, cam1y, cam1z);
        return 1;
    }
    return 0;
}
You should try using OnPlayerCommandText.

https://sampwiki.blast.hk/wiki/OnPlayerCommandText
https://sampwiki.blast.hk/wiki/OnPlayerUpdate
Reply
#5

Yes, but I don`t know how to make it call onplayerupdate Like when I type /cam1 it goes to OnPlayerUpdate.
Reply
#6

Quote:
Originally Posted by vakhtang
Посмотреть сообщение
Yes, but I don`t know how to make it call onplayerupdate Like when I type /cam1 it goes to OnPlayerUpdate.
Timers?
Reply
#7

I used Timers But They Are LAGGY
Reply
#8

Quote:
Originally Posted by vakhtang
Посмотреть сообщение
I used Timers But They Are LAGGY
OnPlayerUpdate will be more laggy than timers.
If you wan't to update the player camera you should use a timer, it's better for this type of scripting.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)