PDA

View Full Version : presentation system


Slicebook
11/02/2014, 10:12 PM
Hello

How can I resolve to see the other player's name forever, and she is mine,If we introduce each other with the help of command? Example: A player /hello, the other player /helloaccept. and if we step out or we enter we would see each other's name likewise.

help please!

role play should this script..

marwanalramahi
12/02/2014, 11:40 AM
Sorry it was my mistake check the post down there

CuervO
12/02/2014, 11:57 AM
To the above post: not really..

You have to use these functions:

http://wiki.sa-mp.com/wiki/ShowPlayerNameTagForPlayer
http://wiki.sa-mp.com/wiki/OnPlayerStreamIn

If you want for such variables to save, then SQL would be the best way to store player relationships.
(relationships table: one column AND one row per every player)

Layout:


player BOB CHRIS JOE

BOB null 1 0
CHRIS 1 null 1
JOE 0 1 null


Bob knows Chris, and doesn't know joe
Chris knows both bob and joe
Joe doesn't know bob but knows chris


Example

SELECT * FROM `relationships` WHERE `player` = 'BOB' AND `CHRIS` = 1

If there's any result then bob is a friend of chris, else, they are not friends.

Slicebook
12/02/2014, 03:20 PM
I went so far. How can you save? Would you describe it to me?

#include <a_samp>
#include <sscanf2>
#include <zcmd>
#include <dini>
#define COLOR_WHITE 0xFFFFFFAA
//
new Names[MAX_PLAYERS][3];
//
public OnFilterScriptInit()
{
ShowNameTags ( 0 ) ;
return 1;
}

CMD:bemutatkoz(playerid, params[])
{
new ID;
#pragma tabsize 0
new string[200], item[32];
new mName[MAX_PLAYER_NAME];
new pName[MAX_PLAYER_NAME];
new Float:X, Float: Y, Float:Z;
if(sscanf(params, "u",item, ID)) return SendClientMessage(playerid, -1, "Használat: /bemutatkozas neki ID/Név");
GetPlayerPos(playerid, X, Y, Z);
if(!IsPlayerInRangeOfPoint(ID, 5.0, X, Y, Z)) return SendClientMessage(playerid, -1, "Nincs a megadott játékos a közeledben!");
if(strcmp(item,"neki",true) == 0) {
if (sscanf(params, "s[32]u",item, ID)) return SendClientMessage(playerid, -1, "Használat: /bemutatkozás neki [ID/Név]");
GetPlayerName(playerid, mName, sizeof(mName));
GetPlayerName(ID, pName, sizeof(pName));
format(string, sizeof(string), "(( %s szeretne az ismerősöd lenni. ))", mName);
SendClientMessage(ID, COLOR_WHITE, string);
SendClientMessage(ID, COLOR_WHITE, "(( Bemutatkozáshoz: /bemutatkozas");
format(string, sizeof(string), "(( Felajánlottad hogy szeretnél bemutatkozni %s-nak", pName);
SendClientMessage(playerid, COLOR_WHITE, string);
Names[ID][0] = 1;
}
return 1;
}

CMD:bemutatkozas(playerid, params[])
{
new ID;
#pragma tabsize 0
new string[200];
new mName[MAX_PLAYER_NAME];
new pName[MAX_PLAYER_NAME];
// new Float: X, Float: Y, Float: Z;
if(Names[playerid][0] == 1)
{
SendClientMessage(playerid, -1, "(( Bemutatkoztál valakinek! ))");
GetPlayerName(playerid, mName, 24);
GetPlayerName(ID, pName, 24);
format( string, sizeof ( string ), "(( %s bemutatkozott neked. ))", mName);
SendClientMessage( ID, -1, string );
ShowPlayerNameTagForPlayer(playerid, ID, true);
ShowPlayerNameTagForPlayer(ID, playerid, true);
}

ColeMiner
12/02/2014, 03:27 PM
If you want for such variables to save, then SQL would be the best way to store player relationships.
(relationships table: one column AND one row per every player)

Layout:


player BOB CHRIS JOE

BOB null 1 0
CHRIS 1 null 1
JOE 0 1 null


Bob knows Chris, and doesn't know joe
Chris knows both bob and joe
Joe doesn't know bob but knows chris


Example

SELECT * FROM `relationships` WHERE `player` = 'BOB' AND `CHRIS` = 1

If there's any result then bob is a friend of chris, else, they are not friends.

You're doing SQL wrong! Your table should only need 2 columns, not as many columns as you have players - that's not what SQL is designed for!