SetPlayerVelocity doesnt work - 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: SetPlayerVelocity doesnt work (
/showthread.php?tid=429110)
SetPlayerVelocity doesnt work -
HurtLocker - 08.04.2013
I have made this situation to happen when somebody approaches Fallout's admincastle. The player's velocity to be multiplicated by 0.2 each 0.1 second. But the SetPlayerVelocity has no effect. Although, the message "muahaha..." appears i dont get like stuck. What's wrong?
pawn Код:
public ACareachecker()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new intruder[MAX_PLAYER_NAME], file[200], Float:X, Float:Y, Float:Z;
GetPlayerName(i, intruder, sizeof(intruder));
GetPlayerPos(i, X, Y, Z);
format(file, sizeof(file), "\\users\\%s.ini", intruder);
if (X>-3748.2446 && Y>-325.8979 && X<-3172.2207 && Y<170.7440 && (dini_Int(file, "AdminLevel")==0 || !dini_Exists(file)))
{
// RemovePlayerFromVehicle(i);
if (istoAC[i]==false)
{
GameTextForPlayer(i, "~w~you were warned", 3000, 3);
actimer=SetTimerEx("AntiWalkTimer", 100, 1, "d", i);
istoAC[i]=true;
}
}
else
{
istoAC[i]=false;
KillTimer(actimer);
}
}
}
return 1;
}
public AntiWalkTimer(i)
{
new Float:Velocity[3];
GetPlayerVelocity(i, Velocity[0], Velocity[1], Velocity[2]);
SetPlayerVelocity(i, 0.2*Velocity[0], 0.2*Velocity[1],0.3*Velocity[2]);
GameTextForPlayer(i, "~w~MUAHAHAHAHA - ~r~ANTIWALK ACTIVATED!", 4000, 3);
return 1;
}
I made RemovePlayerFromVehicle(i); comment cause I wanted to see if the effect takes place while plaryer on nrg but still nothing.
EDIT: I tested it again and the AntiWalkTimer doesnt work at all, neither the message muahaha appears.
Re: SetPlayerVelocity doesnt work -
HurtLocker - 08.04.2013
I replaced "i" with "playerid" in the AntiWalkTimer and now the gametextforplayer "MUAHAHA..." appears but theres no effect on the player's speed.What's wrong?
pawn Код:
public ACareachecker()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new intruder[MAX_PLAYER_NAME], file[200], Float:X, Float:Y, Float:Z;
GetPlayerName(i, intruder, sizeof(intruder));
GetPlayerPos(i, X, Y, Z);
format(file, sizeof(file), "\\users\\%s.ini", intruder);
if (X>-3748.2446 && Y>-325.8979 && X<-3172.2207 && Y<170.7440 && (dini_Int(file, "AdminLevel")==0 || !dini_Exists(file)))
{
// RemovePlayerFromVehicle(i);
if (istoAC[i]==false)
{
GameTextForPlayer(i, "~w~you were warned", 3000, 3);
actimer=SetTimerEx("AntiWalkTimer", 100, 1, "d", i);
istoAC[i]=true;
}
}
else
{
istoAC[i]=false;
KillTimer(actimer);
}
}
}
return 1;
}
public AntiWalkTimer(playerid)
{
new Float:Velocity[3];
GetPlayerVelocity(playerid, Velocity[0], Velocity[1], Velocity[2]);
SetPlayerVelocity(playerid, 0.2*Velocity[0], 0.2*Velocity[1],0.3*Velocity[2]);
GameTextForPlayer(playerid, "~w~MUAHAHAHAHA - ~r~ANTIWALK ACTIVATED!", 4000, 3);
return 1;
}
I made RemovePlayerFromVehicle(i); comment cause I wanted to see if the effect takes place while plaryer on nrg but still nothing.