View Full Version : Problems.

25/08/2012, 12:04 PM
Hi. My problems:

1. I set player world to 1, but i don't see pickups? why? how to set pickup virtual world?

2. When player spawn i get player color and set it to variable:

SAVEPLAYERCOLOR[ playerid ] = GetPlayerColor( playerid );

But when i print variable, or color i get 0:

printf("PLAYER COLOR: %d", GetPlayerColor( playerid ) );
printf("COLOR: %d",SAVEPLAYERCOLOR[ playerid ] );

3. When player die i send death message:

SendDeathMessage(killerid, playerid, reason);

3.1. Player in other world get death message?

3.2. I write text in 0 world, but player is in 1 world, he get message?

3.3. Death message will see all players?

25/08/2012, 12:14 PM
1) CreatePickup(model, type, X, Y, Z, virtualworld)
Just change 'virtualworld' paramter to whatever world the pickup is in. (-1 for all virtual worlds)

2)printf("PLAYER COLOR: %x", GetPlayerColor(playerid));
GetPlayerColor returns a hex value. You need to use %x as a format for hex values, not a digit (%d)

3 + 3.1) SendDeathMessage will send to all online players.
3.2) By default, the player WILL get the message.
If you only want messages to send to players in the same world, use this:
public OnPlayerText(playerid, text[])
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
format(string,sizeof(string),"%s (%d): %s", pname, playerid, text);
for(new i = 0; i < MAX_PLAYERS; i++)
if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid)) //Will send to only if they are in same world
SendClientMessage(i, 0xFFFFFF, string);
return 0;

3.3) Same as 3.1

25/08/2012, 01:29 PM
Thx helped. But with colors no. I print with %x i still get 0. Maybe when player spawn he get color later?

25/08/2012, 02:17 PM
How to set all objects virtual world 0 ? i have a lot of objects and it take a lot of time to add ",0". Maybe is faster way how to do it?

25/08/2012, 02:39 PM
Objects dont use virtual worlds, and for pickups their default virtual world is 0, so you dont need to put anything in your code

Also this should help you with your color problem, CLICK (http://wiki.sa-mp.com/wiki/GetPlayerColor)