GTAOnline.net
San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: ApocKalipsS le 27 Décembre 2007, 18:38:10
-
Slut ! :cheers
Je viens de faire un timer :
public AutoPay(playerid)
{
GivePlayerMoney(playerid, 3500);
SendClientMessage(playerid, COLOR_GREEN,"Jour De Paye !");
SendClientMessage(playerid, COLOR_RED,"Tu as reçu 3500$ !");
}(Avec biensûr tous les new, forward et SetTimer...)
Et la paye ne s'adresse que pour l'id 0, pourquoi ?
Merci de m'aider ! :D
-
la boucle mon ami, la boucle ;)
public AutoPay(playerid)
{
SendClientMessageToAll(COLOR_GREEN,"Jour De Paye !");
SendClientMessageToAll(COLOR_RED,"Tu as reçu 3500$ !");
for(new i=0; i<MAX_PLAYERS; i++)
{
GivePlayerMoney(i, 3500);
}
}
++
R@f
-
Ok merci ça marche !
2° question : il n'y a pas une ligne qui permet de dire si il est un skin de taxi ?
Ex : If IsPlayerIsSkin253
SiLeJoueurALeSkin253
Voila merci !
Enfete voila ce que je veux faire :
Quand quelqu'un tape /taxi, tous les joueurs en skin de taxi sont prévenu que le joueur ** ID ** veut un taxi.
Voila si c'est possible...
:D
-
c'est pas une ligne mais un code ;)
Donc, la boucle pour que chaque joueur soit concerner
On fait un getplayer skin pour voir quel skin les joueurs possèdent (c'est "les joueurs" parce que ont as la boucle ^^)
On regarde si le skin correspond au 253, si oui on lui dit qu'il peut etre chauffeur, et si non, c'est le contraire ;)
for(new i = 0; i < MAX_PLAYERS; i ++) {
if(GetPlayerSkin(i) == 253) {
SendClientMessage(i, COLOR_GREEN,"Tu as le skin de taxi, tu peux etre chauffeur");
}else{
SendClientMessage(i, COLOR_RED,"Tu n'as pas le skin de taxi, tu peux pas etre chauffeur !");
}
}
}
Je n'ai pas compilé le code et je ne l'ai pas tester, si sa marche pas poste moi ton problème ;)
++
R@f
-
Ok merci is je voudrais faire que quand je tape /taxi ca mais un message au joueur qui ont le skin 253..
Je ne sais pas comment faire, aidez moi ! :)
-
je vais quand même pas tout te donner, noël c'est déjà passé ^^ mais essaye de faire une commande avec le code que je t'ai donné
++
R@f
-
Mais je veux un message à tous els chauffeurs, donc une boucle :-\ ?
-
Bon j'ai essayé ça :
if(strcmp(cmd, "/taxi", true) == 0){
SendClientMessage(playerid, COLOR_GREEN, "Tu a appeler un taxi !");
for(new i = 0; i < MAX_PLAYERS; i ++) {
if(GetPlayerSkin(i) == 255) {
SendClientMessage(playerid, COLOR_RED, "TEST");
}
}
}
}Ca marche pas...
Aidez-moi c'est dur ! :(
...
Un Indice ?
-
if(strcmp(cmd, "/taxi", true) == 0)
{
SendClientMessage(playerid, COLOR_GREEN, "Tu a appeler un taxi !");
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(GetPlayerSkin(i) == 255)
{
SendClientMessage(i, COLOR_RED, "TEST");
}
}
}
return 1;
}
-
if(strcmp(cmd, "/taxi", true) == 0){
new pid[256];
new tmpp[256];
new pidName[MAX_PLAYER_NAME];
SendClientMessage(playerid, COLOR_GREEN, "Tu a appeler un taxi !");
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(GetPlayerSkin(i) == 255)
{
GetPlayerName (playerid, pidName, 255);
format(tmpp, sizeof(tmpp), "*** %s (ID:%d) a appeler un taxi***",pidName,pid);
SendClientMessageToAll(0x33AA33AA, tmpp);
GameTextForAll("]Un joueur a appeler un taxi !]", 3500, 5);
GameTextForPlayer(playerid,"~r~]Un joueur a appeler un taxi !]",3500,5);
}
if(GetPlayerSkin(i) == 240)
{
GetPlayerName (playerid, pidName, 255);
format(tmpp, sizeof(tmpp), "*** %s (ID:%d) a appeler un taxi***",pidName,pid);
SendClientMessageToAll(0x33AA33AA, tmpp);
GameTextForAll("]Un joueur a appeler un taxi !]", 3500, 5);
GameTextForPlayer(playerid,"~r~]Un joueur a appeler un taxi !]",3500,5);
}
}
}
}
Voila mon script mais le souci c'est que tous le monde voit le GameText et le SendMessage ! ;D Aidez-moi ! :D
-
Quel texte tout le monde voi ?
NV.
-
Ils voyent :
format(tmpp, sizeof(tmpp), "*** %s (ID:%d) a appeler un taxi***",pidName,pid);
et :
GameTextForPlayer(playerid,"~r~]Un joueur a appeler un taxi !]",3500,5);
Voila merci de m'aider ! :D :D
-
Pour le
format(tmpp, sizeof(tmpp), "*** %s (ID:%d) a appeler un taxi***",pidName,pid);
C'est normal, c'est un
SendClientMessageToAll(0x33AA33AA, tmpp);
Pour l'autre je voi pas !
NV.
-
if(strcmp(cmd, "/taxi", true) == 0)
{
new pid[256];
new tmpp[256];
new pidName[MAX_PLAYER_NAME];
SendClientMessage(playerid, COLOR_GREEN, "Tu a appeler un taxi !");
{
for(new i = 0; i < MAX_PLAYERS; i ++){
if(GetPlayerSkin(i) == 255){
GetPlayerName (playerid, pidName, 255);
format(tmpp, sizeof(tmpp), "*** %s (ID:%d) a appeler un taxi***",pidName,pid);
SendClientMessage(i, COLOR_GREEN,tmpp);
}
if(GetPlayerSkin(i) == 240){
GetPlayerName (playerid, pidName, 255);
format(tmpp, sizeof(tmpp), "*** %s (ID:%d) a appeler un taxi***",pidName,pid);
SendClientMessageToAll(0x33AA33AA, tmpp);
GameTextForAll("]Un joueur a appeler un taxi !]", 3500, 5);
GameTextForPlayer(playerid,"~r~]Un joueur a appeler un taxi !]",3500,5);
}
return 1;
}
}
}
Voila mon script et la je vois que "Tu a appeler un taxi" et les autres ne voyent rien du tous même pas les 255 et 240 !