Myths in SA:MP
#1

I want to show you frauds in wiki.sa-mp.com.

1. AddStaticVehicle works not only in OnGameModeInit.

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(!strcmp(cmdtext, "/hydra", true))
	{
		new Float:X, Float:Y, Float:Z, Float:A;
		GetPlayerPos(playerid, X, Y, Z);
		GetPlayerFacingAngle(playerid, A);
		AddStaticVehicle(520, X, Y, Z, A, 0, 0);
		return 1;
	}
	return 0;
}
Vehicle shows up and works good.

2. AddStaticVehicle returns ID of created vehicle.


Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(!strcmp(cmdtext, "/hydra", true))
	{
		new Float:X, Float:Y, Float:Z, Float:A;
		GetPlayerPos(playerid, X, Y, Z);
		GetPlayerFacingAngle(playerid, A);
		printf("%d", AddStaticVehicle(520, X, Y, Z, A, 0, 0));
		return 1;
	}
	return 0;
}
After few uses of this command, console shows:
Quote:

[12:41:56] 1
[12:42:04] 2
[12:42:08] 3
[12:42:16] 4

3. Removing vehicles created with AddStaticVehicle:

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(!strcmp(cmdtext, "/hydra", true))
	{
		new Float:X, Float:Y, Float:Z, Float:A;
		GetPlayerPos(playerid, X, Y, Z);
		GetPlayerFacingAngle(playerid, A);
		printf("%d", AddStaticVehicle(520, X, Y, Z, A, 0, 0));
		return 1;
	}

	if(!strcmp(cmdtext, "/d", true, 2))
	{
		printf("%d", strval(cmdtext[3]));
		DestroyVehicle(strval(cmdtext[3]));
		return 1;
	}
	return 0;
}
Worked good.
Reply
#2

erm and now the world blows up?
jk
but wayne that post was useless

it sumin everyone should kno tho..
no real myths XD
Reply
#3

1) thats normal
2) Thats what it should do
3) AddStaticVehicle and CreateVehicle can both be removed whit that

so no myths here
Reply
#4

I say about myths in wiki.sa-mp.com.

https://sampwiki.blast.hk/wiki/AddStaticVehicle

Quote:

This function can only create vehicles in the OnGameModeInit callback, and vehicles created with this function cannot be removed

Quote:

This function does not return a specific value, it's best to simply ignore it.

Quote:

If you've found problems - CHANGE THEM

Registration is locked, cannot change it without account.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)