GTAOnline.net

San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: marsu le 02 Février 2008, 19:24:25

Titre: Commands qui marche pas
Posté par: marsu le 02 Février 2008, 19:24:25
Voila ma creation parsque je mennuyai :)

if (strcmp(cmdtext, "/sms17", true) == 0) {

format(string, sizeof(string), "[ ! ]%s:Demande La Police (Son id: %d).", PlayerName, playerid);
        SendClientMessage(PlayerName,giveplayerid, COLOR_RED1, string);
return 1;
}

Mais ya 1 erreur :(

error 035: argument type mismatch (argument 1)
Titre: Re : Commands qui marche pas
Posté par: ApocKalipsS le 02 Février 2008, 20:01:59
J'imagine que tu veux envoyer un message aux policiers ?
Titre: Re : Commands qui marche pas
Posté par: NatiVe™ le 02 Février 2008, 20:02:25
Lol,

Tu met PlayerName, playerid sans l'avoir definie !

Aller je t'aide...

GetPlayerName(cherche pour la);
NV.

Titre: Re : Commands qui marche pas
Posté par: marsu le 02 Février 2008, 20:46:27
Ou je met le

GetPlayerName(cherche pour la); ? plz
Titre: Re : Commands qui marche pas
Posté par: NatiVe™ le 02 Février 2008, 20:50:22
Avant le message

NV.

Titre: Re : Commands qui marche pas
Posté par: marsu le 02 Février 2008, 20:51:42
Je voit toujour pas :(

un exemple stp
Titre: Re : Commands qui marche pas
Posté par: Eloctro le 02 Février 2008, 21:09:05
Aller moi je me lance je sui pas sur ses pas mon genre de commmande :
if (strcmp(cmdtext, "/sms17", true) == 0) {
GetPlayerName(player);
format(string, sizeof(string), "[ ! ]%s:Demande La Police (Son id: %d).", PlayerName, playerid);
        SendClientMessage(PlayerName,giveplayerid, COLOR_RED1, string);
return 1;
}
Titre: Re : Commands qui marche pas
Posté par: marsu le 02 Février 2008, 21:11:40
Non c'est pas sa mais sa ressemble


if (strcmp(cmdtext, "/sms17", true) == 0) {
        GetPlayerName(player,giveplayerid,playerid);
format(string, sizeof(string), "[ ! ]%sQuelqu'un Demande La Police (Son id: %d).",playerid);
        SendClientMessage(giveplayerid, COLOR_RED1, string);
return 1;
}

erreur

error 017: undefined symbol "player"
Titre: Re : Commands qui marche pas
Posté par: NatiVe™ le 02 Février 2008, 21:21:43
Voila...

if (strcmp(cmdtext, "/sms17", true) == 0) {
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), "[ ! ] %s: Demande La Police (Son id: %d).", PlayerName, playerid);
SendClientMessage(PlayerName,giveplayerid, COLOR_RED1, string);
return 1;
}

J'ai pas tester !

NV.

Titre: Re : Commands qui marche pas
Posté par: marsu le 02 Février 2008, 21:23:55
preske :(

error 017: undefined symbol "PlayerName"
error 017: undefined symbol "PlayerName"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line

Avec ton code jai mis new PlayerName;

Est voila

warning 225: unreachable code
argument type mismatch (argument 2)
error 035: argument type mismatch (argument 2)
error 035: argument type mismatch (argument 3)
Titre: Re : Commands qui marche pas
Posté par: NatiVe™ le 02 Février 2008, 21:59:20
Quel endouille que je suis !

if (strcmp(cmdtext, "/sms17", true) == 0) {
new PlayerName[MAX_PLAYER_NAME];
new string[256];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), "[ ! ] %s: Demande La Police (Son id: %d).", PlayerName, playerid);
SendClientMessage(PlayerName,giveplayerid, COLOR_RED1, string);
return 1;
}

NV.

Titre: Re : Commands qui marche pas
Posté par: marsu le 02 Février 2008, 22:10:59
Toujour pas

D:\PROGRA~1\ROCKST~1\GTASAN~1\FILTER~1\sad.pwn(140) : warning 225: unreachable code
D:\PROGRA~1\ROCKST~1\GTASAN~1\FILTER~1\sad.pwn(183) : warning 219: local variable "PlayerName" shadows a variable at a preceding level
D:\PROGRA~1\ROCKST~1\GTASAN~1\FILTER~1\sad.pwn(184) : warning 219: local variable "string" shadows a variable at a preceding level
D:\PROGRA~1\ROCKST~1\GTASAN~1\FILTER~1\sad.pwn(187) : error 035: argument type mismatch (argument 1)
D:\PROGRA~1\ROCKST~1\GTASAN~1\FILTER~1\sad.pwn(179) : warning 203: symbol is never used: "PlayerName"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Error.

Titre: Re : Commands qui marche pas
Posté par: ApocKalipsS le 03 Février 2008, 09:30:57
C'est quel ligne le "187" ?
Titre: Re : Commands qui marche pas
Posté par: marsu le 03 Février 2008, 10:55:36
Une des lignes des command /sms17
Titre: Re : Commands qui marche pas
Posté par: lilem le 05 Février 2008, 12:42:54
tien je chercher aussi un peux prés une commandes comme ça mais saufe pas pour la police  :jesors
Titre: Re : Commands qui marche pas
Posté par: Syg le 05 Février 2008, 14:07:41
Bon Marsu, va falloir réfléchir un peu de ton coté sinon ce post ne va plus en finir.

D:\PROGRA~1\ROCKST~1\GTASAN~1\FILTER~1\sad.pwn(140) : warning 225: unreachable code
-> Ca ça veut dire que la ligne 140 (et les suivantes) ne seront JAMAIS exécutées.
Solution : Tu dois avoir un return avant, déplace le après ta commande (mais ce warning ne concerne peut-être pas ta commande /sms17)

D:\PROGRA~1\ROCKST~1\GTASAN~1\FILTER~1\sad.pwn(183) : warning 219: local variable "PlayerName" shadows a variable at a preceding level
-> Ca, ça veut dire que le variable "PlayerName" est déjà définie quelque part dans ton script
Solution : Supprime la ligne 183

D:\PROGRA~1\ROCKST~1\GTASAN~1\FILTER~1\sad.pwn(184) : warning 219: local variable "string" shadows a variable at a preceding level
-> Ca, ça veut dire que le variable "string" est déjà définie quelque part dans ton script
Solution : Supprime la ligne 184

D:\PROGRA~1\ROCKST~1\GTASAN~1\FILTER~1\sad.pwn(187) : error 035: argument type mismatch (argument 1)
-> Ca ça veut dire que l'argument 1 (PlayerName) de la fonction SendClientMessage n'a pas le bon type
Solution : Le premier argument (paramètre) de la fonction SendClientMessage est un ID de joueur, pas un nom donc remplace PlayerName par playerid.

D:\PROGRA~1\ROCKST~1\GTASAN~1\FILTER~1\sad.pwn(179) : warning 203: symbol is never used: "PlayerName"
-> Ce warning va disparaitre lorsque tu auras supprimé la ligne 183.

++
Syg