params -
DreyPT - 08.06.2012
if(strcmp(params, "d", type))
eu tentei mudar isto para strcmp..
tava em sscanf
mas dб erro
desconhece o params.
alguйm ajuda?
Re: (apagar) sff -
DreyPT - 08.06.2012
Alguйm ajuda ??
Re: (apagar) sff -
DrTHE - 08.06.2012
poste o comando original completo
Re: (apagar) sff -
DreyPT - 08.06.2012
pawn Код:
if (strcmp("/sirene", cmdtext, true, 10) == 0)
{
if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 1)
{
new type;
new VID = GetPlayerVehicleID(playerid);
if(strcmp(params, "d", type))
{
SendClientMessage(playerid, COLOR_WHITE, "USA: /sirene [tipo]");
SendClientMessage(playerid, COLOR_GRAD2, "Type: 1 = Em cima, 2 = Capф, 3 = Desligar.");
return 1;
}
switch(type)
{
case 1:
{
if(Siren[VID] == 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "Este veнculo jб tкm sirene.!");
return 1;
}
new objectid = CreateObject(19419, 0, 0, 0, 0, 0, 0);
AttachObjectToVehicle(objectid, GetPlayerVehicleID(playerid), 0.009999, -0.019999, 0.944999, 0.000000, 0.000000, 0.000000); //Object Model: 19419 |
PlayerActionMessage(playerid,15.0,"coloca a sirene no veнculo.");
return 1;
}
case 2:
{
if(Siren[VID] == 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "Este veнculo jб tкm sirene.!");
return 1;
}
Siren[VID] = 1;
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
AttachObjectToVehicle(SirenObject[VID], VID, -0.43, 0.0, 0.785, 0.0, 0.1, 0.0);
PlayerActionMessage(playerid,15.0,"coloca a sirene no veнculo.");
return 1;
}
case 3:
{
if(Siren[VID] == 0)
{
SendClientMessage(playerid, COLOR_GRAD2, "Este veнculo nгo tкm sirene.!");
return 1;
}
Siren[VID] = 0;
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
DestroyObject(SirenObject[VID]);
PlayerActionMessage(playerid,15.0,"retira a sirene no veнculo.");
return 1;
}
default:
{
SendClientMessage(playerid, COLOR_WHITE, "USA: /sirene [tipo]");
SendClientMessage(playerid, COLOR_GRAD2, "Type: 1 = Em cima, 2 = Capф, 3 = Desligar.");
}
}
}
else SendClientMessage(playerid, COLOR_GREY, "You're not authorised to use this command.");
return 1;
}
Re: (apagar) sff -
DrTHE - 08.06.2012
pawn Код:
new tmp[24], type, VID = GetPlayerVehicleID(playerid);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USA: /sirene [tipo]");
SendClientMessage(playerid, COLOR_GRAD2, "Type: 1 = Em cima, 2 = Capф, 3 = Desligar.");
return 1;
}
type = strval(tmp);
Re: (apagar) sff -
DreyPT - 08.06.2012
Dб-me bastantes erros no case 1.
Re: (apagar) sff -
DrTHE - 08.06.2012
troque as case
pawn Код:
/*switch(type)
{
case 1:
{*/
if(type == 1)
{//...
if(type == 2)
{//....
if(type == 3)
{//....
Re: (apagar) sff -
DreyPT - 08.06.2012
e default o q ponho ?
Re: (apagar) sff -
DrTHE - 08.06.2012
pawn Код:
if(strcmp("/sirene", cmdtext, true, 10) == 0)
{
if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 1)
{
new tmp[24], type, VID = GetPlayerVehicleID(playerid);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USA: /sirene [tipo]");
SendClientMessage(playerid, COLOR_GRAD2, "Type: 1 = Em cima, 2 = Capф, 3 = Desligar.");
return 1;
}
type = strval(tmp);
if(type <= 0 || > 3)return SendClientMessage(playerid, COLOR_WHITE, "USA: /sirene [1 a 3]");
if(type == 1)
{
if(Siren[VID] == 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "Este veнculo jб tкm sirene.!");
return 1;
}
new objectid = CreateObject(19419, 0, 0, 0, 0, 0, 0);
AttachObjectToVehicle(objectid, GetPlayerVehicleID(playerid), 0.009999, -0.019999, 0.944999, 0.000000, 0.000000, 0.000000); //Object Model: 19419 |
PlayerActionMessage(playerid,15.0,"coloca a sirene no veнculo.");
return 1;
}
else if(type == 2)
{
if(Siren[VID] == 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "Este veнculo jб tкm sirene.!");
return 1;
}
Siren[VID] = 1;
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
AttachObjectToVehicle(SirenObject[VID], VID, -0.43, 0.0, 0.785, 0.0, 0.1, 0.0);
PlayerActionMessage(playerid,15.0,"coloca a sirene no veнculo.");
return 1;
}
else if(type == 3)
{
if(Siren[VID] == 0)
{
SendClientMessage(playerid, COLOR_GRAD2, "Este veнculo nгo tкm sirene.!");
return 1;
}
Siren[VID] = 0;
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
DestroyObject(SirenObject[VID]);
PlayerActionMessage(playerid,15.0,"retira a sirene no veнculo.");
return 1;
}
}
}
else SendClientMessage(playerid, COLOR_GREY, "You're not authorised to use this command.");
return 1;
}
ve se estб a funcionar assim.
Re: (apagar) sff -
DreyPT - 08.06.2012
warning 219: local variable "tmp" shadows a variable at a preceding level
pawn Код:
new tmp[24], type, VID = GetPlayerVehicleID(playerid);
error 047: array sizes do not match, or destination array is too small
pawn Код:
tmp = strtok(cmdtext, idx);
error 029: invalid expression, assumed zero
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
pawn Код:
if(type <= 0 || > 3)return SendClientMessage(playerid, COLOR_WHITE, "USA: /sirene [1 a 3]");