dcmd_trascina(playerid, params[])
{
new id, string[ 128 ];
if( sscanf( params, "u", id) )
{
SendClientMessage( playerid, COLOR_WHITE, "USO: /trascina [PlayerID/PartOfName]" );
}
else
{
if(IsACop(playerid))
{
if(GetDistanceBetweenPlayers( playerid, id) < 7)
{
ApplyAnimation(id,"SWEET","Sweet_injuredloop", 4.0, 1, 0, 0, 0, 0,1);
ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0,1);
PlayerInfo[id][BeingDraggedBy] = playerid;
//format( string, sizeof( string ), "You have started to drag %s.", PlayerName(id) );
//SendClientMessage( playerid, COLOR_LIGHTBLUE, string);
format( string, sizeof( string ), "* %s prende il braccio di %s e lo trascina.", PlayerName(playerid), PlayerName(id) );
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
SendClientMessage( playerid, COLOR_GRAD1, "Sei troppo lontano!" );
}
}
else
{
SendClientMessage( playerid, COLOR_GRAD1, "Non sei un poliziotto." );
}
}
return 1;
}
dcmd_strascina(playerid, params[])
{
#pragma unused params
new string[73];
for( new i = 0; i < MAX_PLAYERS; i++ )
{
if(IsPlayerConnected( i ) && PlayerInfo[i][BeingDraggedBy] == playerid)
{
//format( string, sizeof( string ), "You have stopped dragging %s.", PlayerName(playerid) );
//SendClientMessage( playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s lascia il braccio di %s.", PlayerName(playerid), PlayerName(i) );
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
PlayerInfo[i][BeingDraggedBy] = -1;
ClearAnimations(playerid);
}
}
return 1;
}
if(strcmp(cmd, "/fittaauto", true) == 0)//Trasfoma in dialog
{
//GameTextForPlayer(playerid, " ", 500, 4);
new vID = GetPlayerVehicleID(playerid);
if (!vID)
{
SendClientMessage(playerid, -1, "Non sei {3399CC}in nessun'{FFFFFF}auto!");
return 1;
}
if (!IsRentableCar(vID))
{
SendClientMessage(playerid, -1, "Quest'auto non и {3399CC}noleggiabile{FFFFFF}!");
return 1;
}
if (IsRentedCar(vID))
{
SendClientMessage(playerid, -1, "Quest'auto {3399CC}и giа stata{FFFFFF} noleggiata!");
return 1;
}
if (GetPVarInt(playerid, "Renting") == 1)
{
SendClientMessage(playerid, -1, "Hai giа {3399CC}noleggiato{FFFFFF} un'auto!");
return 1;
}
if (!CanAffordRental(playerid))
{
new String[128];
format(String, 128, "Non hai abbastanza soldi per noleggiare quest'auto{3399CC}(Costo: %d)", RENT_COST);
SendClientMessage(playerid, -1, String);
return 1;
}
IsRented[vID] = 1;
TogglePlayerControllable(playerid, 1);
SetPVarInt(playerid, "CarRentID", vID);
SetPVarInt(playerid, "Renting", 1);
new String[128];
format(String, 128, "~rNOLEGGIO LS~w~VEICOLO NOLEGGIATO", RENT_COST);
GameTextForPlayer(playerid, String, 4000, 4);
RentedBy[vID] = GetName(playerid);
GivePlayerMoney(playerid, -RENT_COST);
PlayerInfo[playerid][pCash] -= 25;
SendClientMessage(playerid, -1, "{3399CC}Veicolo noleggiato!{FFFFFF} Adesso puoi accendere il veicolo!");
return 1;
}
Use only one for commands. For example, use only dcmd in the same mode. Do not use, some commands with dcmd, some others with strcmp and some others with ZCMD etc.
|
But dcmd commands do not. I recommend you to use ZCMD with sscanf, it's really good combination and you'll never have problems with it!
|