GTAOnline.net
San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: Myk3L le 01 Juillet 2010, 14:32:44
-
Salut !
Je suis en train de créer une petit serveur de stunt/dm/drift ... sympa mais comme j'adore le RP, j'ai envie de mettre une dose de RP. J'ai crée des commandes comme le /me, /da, /b ... mais mon problème, c'est que tout le serveur voit ce que je dis même si je suis à l'opposé de lui sur la carte, je sais c'est d'origine mais j'aimerais trouvé un bout de code qui gère ça histoire que ça soit plus sympas !
(http://i60.servimg.com/u/f60/13/00/22/44/sa-mp-10.jpg)
Comme cela, (l'image n'es pas de moi ;) )
Merci d'avance :)
-
Salut :)
en haut de ton script
new realchat = 1;
et dans onplayertext
if (realchat)
{
format(string, sizeof(string), "%s dit: %s", sendername, text);
SetPlayerChatBubble(playerid, string, TEAM_ORANGE, 100.0, 10000);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
}
Biensur il faut que à la fin de ton OnPlayerText, tu mettent return 0; à la place de return 1; sinon tu aura le message de base qui va s'envoyer :)
A+ Sam. :cheers
-
Wow' rapide !
Merci je test ;)
EDIT :
J'ai ça :
public OnPlayerText(playerid, string[])
{
new text[400];
new sendername[128];
GetPlayerName(playerid, sendername, sizeof(sendername));
if (realchat)
{
format(string, sizeof(string), "%s dit: %s", sendername, text);
SetPlayerChatBubble(playerid, string, ORANGE, 100.0, 10000);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
}
return 0;
}
Mais il refuse de compiler car je n'ai pas ajouté le header pour "ProxDetector", mais quel est ce header ?! J'ai pas l'impression de l'avoir x)
Merci d'avance :)
-
Désolé je jouais ^^
forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
if(IsPlayerConnected(playerid))
{
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
//radi = 2.0; //Trigger Radius
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(!BigEar[i])
{
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
{
SendClientMessage(i, col1, string);
}
else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
{
SendClientMessage(i, col2, string);
}
else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
{
SendClientMessage(i, col3, string);
}
else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
{
SendClientMessage(i, col4, string);
}
else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
SendClientMessage(i, col5, string);
}
}
else
{
SendClientMessage(i, col1, string);
}
}
}
}//not connected
return 1;
}
-
Maintenant j'ai ces erreurs, et je ne sais d'où elle viennent !
C:\Users\proprietaire\Documents\GTA San Andreas User Files\Serveur\pawno\Test3.pwn(118) : error 012: invalid function call, not a valid address
C:\Users\proprietaire\Documents\GTA San Andreas User Files\Serveur\pawno\Test3.pwn(118) : warning 215: expression has no effect
C:\Users\proprietaire\Documents\GTA San Andreas User Files\Serveur\pawno\Test3.pwn(118) : error 001: expected token: ";", but found ")"
C:\Users\proprietaire\Documents\GTA San Andreas User Files\Serveur\pawno\Test3.pwn(118) : error 029: invalid expression, assumed zero
C:\Users\proprietaire\Documents\GTA San Andreas User Files\Serveur\pawno\Test3.pwn(118) : fatal error 107: too many error messages on one line
-
C'est quoi la ligne 118 ??
-
Ah oui en effet, voici :
Tout le code : Pastebin.com (http://pastebin.com/YxjkMBNy)
La ligne 118 : if(!BigEar(i))
-
Bonjour :)
Essaye sa :
if(!BigEar(i) != 1)
-
Ça ne marche pas mieux :)
J'ai aussi tenté de déclaré une nouvelle variable new BigEar; et new BigEar = 0; mais toujours l'erreur ...
-
Ah oui tu ne l'a pas ^^ c'est new BigEar[MAX_PLAYERS]; comme tu "attache" une variable au joueur :)
N'oublie pas dans OnPlayerConnect BigEar[playerid] = 0;
Voila la commande qui va avec :
if(strcmp(cmd, "/grandeoreille", true) == 0 && PlayerInfo[playerid][pAdmin] >= 2)
{
if(IsPlayerConnected(playerid))
{
if (!BigEar[playerid])
{
BigEar[playerid] = 1;
SendClientMessage(playerid, COLOR_GRAD2, " Vos oreilles ont grandi");
}
else if (BigEar[playerid])
{
(BigEar[playerid] = 0);
SendClientMessage(playerid, COLOR_GRAD2, " Vos oreilles ont diminué");
}
}
return 1;
}
Voila tout, escuse moi je pensez que tu l'avais ^^
-
Pffiou !
On y est presque, il me reste un erreur :
C:\Users\proprietaire\Documents\GTA San Andreas User Files\Serveur\pawno\TractorLover.pwn(1723) : error 025: function heading differs from prototype
public OnPlayerText(playerid, string[])
Je vois pas pourquoi ça diffère du prototype :)
-
Yop :) parce que c'est pas sa :)
public OnPlayerText(playerid, text[])
voila :)
-
Merci ça marche !
J'ai du aussi rajouter un new string[128]; :P
Bonne journée !