PDA

View Full Version : can someone convert this for me please from Zcmd to Strcmp


Crossfire1989
17/05/2013, 06:11 AM
i need these commands converted to strcmp format please, rep will be given to the first person to do so
CMD:hitch(playerid, params[])
{
if (IsTrailerAttachedToVehicle(GetPlayerVehicleID(pla yerid))) SendClientMessage(playerid, COLOR_GREY, "You are already towing a Trailer/Vehicle.");
new Float:PPPX,Float:PPPY,Float:PPPZ;
GetPlayerPos(playerid,PPPX,PPPY,PPPZ);
new Float:VVVX,Float:VVVY,Float:VVVZ;
new Found=0;
new vid=0;
while((vid<MAX_VEHICLES)&&(!Found))
{
vid++;
GetVehiclePos(vid,VVVX,VVVY,VVVZ);
if ((floatabs(PPPX-VVVX)<7.0)&&(floatabs(PPPY-VVVY)<7.0)&&(floatabs(PPPZ-VVVZ)<7.0)&&(vid!=GetPlayerVehicleID(playerid)))
{
Found=1;
AttachTrailerToVehicle(vid,GetPlayerVehicleID(play erid));
}

}
if (!Found)
{
SendClientMessage(playerid,COLOR_GREY,"There is no vehicle in range.");
}
return 1;
}

CMD:unhitch(playerid, params[])
{
#pragma unused params

new veh = GetPlayerVehicleID(playerid);

if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_GRAD2, "You must be in a vehicle to do this.");
if(!IsTrailerAttachedToVehicle(veh)) return SendClientMessageEx(playerid, COLOR_GRAD2, "You do not have a trailer attached to your vehicle.");

DetachTrailerFromVehicle(veh);
SendClientMessageEx(playerid, COLOR_GRAD2, "Your trailer has been detached from your vehicle.");

return 1;
}

Guest123
17/05/2013, 06:23 AM
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/hitch", cmdtext, true, 10) == 0)
{
if (IsTrailerAttachedToVehicle(GetPlayerVehicleID(pla yerid))) SendClientMessage(playerid, COLOR_GREY, "You are already towing a Trailer/Vehicle.");
new Float:PPPX,Float:PPPY,Float:PPPZ;
GetPlayerPos(playerid,PPPX,PPPY,PPPZ);
new Float:VVVX,Float:VVVY,Float:VVVZ;
new Found=0;
new vid=0;
while((vid<MAX_VEHICLES)&&(!Found))
{
vid++;
GetVehiclePos(vid,VVVX,VVVY,VVVZ);
if ((floatabs(PPPX-VVVX)<7.0)&&(floatabs(PPPY-VVVY)<7.0)&&(floatabs(PPPZ-VVVZ)<7.0)&&(vid!=GetPlayerVehicleID(playerid)))
{
Found=1;
AttachTrailerToVehicle(vid,GetPlayerVehicleID(play erid));
}
}
if (!Found)
{
SendClientMessage(playerid,COLOR_GREY,"There is no vehicle in range.");
}
return 1;
}
if (strcmp("/unhitch", cmdtext, true, 10) == 0)
{
new veh = GetPlayerVehicleID(playerid);

if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_GRAD2, "You must be in a vehicle to do this.");
if(!IsTrailerAttachedToVehicle(veh)) return SendClientMessageEx(playerid, COLOR_GRAD2, "You do not have a trailer attached to your vehicle.");

DetachTrailerFromVehicle(veh);
SendClientMessageEx(playerid, COLOR_GRAD2, "Your trailer has been detached from your vehicle.");
return 1;
}
return 0;
}

Crossfire1989
17/05/2013, 06:29 AM
thanks :D, just repped you