SA-MP Forums Archive
COmmands - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: COmmands (/showthread.php?tid=581661)



COmmands - ALoX12 - 14.07.2015

PHP код:
CMD:chouse(playeridparams[])
{
        new 
tmp[256];
        new 
cmd[256+1];
        new 
idx;
        
cmd strtok(cmdtextidx);
        
tmp strtok(cmdtext,idx);
        new 
tmp2[256];
        
tmp2 strtok(cmdtext,idx);
        if(!
strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid,-1,"Use: /chouse [price] [intid]");
        new 
id strval(tmp2);
        new 
Price strval(tmp);
        if(
Price <= 0)
        return 
SendClientMessage(playerid,-1,"Invalid house price. The house price must be between $"#MIN_HOUSE_PRICE" and $"#MAX_HOUSE_PRICE"");
        
CreateHouse(playerid,GetFreeHouseID(),Price,id);
        
SendClientMessage(playerid,-1,"House Created");
        return 
1;

someone please convert this into sscanf zcmd


Re: COmmands - kloning1 - 14.07.2015

done
pawn Код:
CMD:chouse(playerid, params[])
{
        new price, int;
        if(sscanf(params, "dd",price, int)) return SendClientMessage(playerid,-1,"Use: /chouse [price] [intid]");
        if(Price <= 0) return SendClientMessage(playerid,-1,"Invalid house price. The house price must be between $"#MIN_HOUSE_PRICE" and $"#MAX_HOUSE_PRICE"");
        CreateHouse(playerid,GetFreeHouseID(),Price,id);
        SendClientMessage(playerid,-1,"House Created");
        return 1;
}



Re: COmmands - ALoX12 - 14.07.2015

also this
PHP код:
CMD:addcar(playerid,params[])
{
        new 
tmp[256];
        new 
cmd[256+1];
        new 
idx;
        
cmd strtok(cmdtextidx);
        
tmp strtok(cmdtext,idx);
        new 
hid strval(tmp);
        if(
IsPlayerInAnyVehicle(playerid))
        {
            new 
Float:X,Float:Y,Float:Z,Float:Angle;
            
GetVehiclePos(GetPlayerVehicleID(playerid), XYZ);
            
GetVehicleZAngle(GetPlayerVehicleID(playerid), Angle);
            new 
model GetVehicleModel(GetPlayerVehicleID(playerid));
            
dini_IntSet(HouseFile(hid),"vModel",model);
            
dini_FloatSet(HouseFile(hid),"vX",X);
            
dini_FloatSet(HouseFile(hid),"vY",Y);
            
dini_FloatSet(HouseFile(hid),"vZ",Z);
            
dini_FloatSet(HouseFile(hid),"vAng",Angle);
        }
        else return 
SendClientMessage(playerid,-1,"You need to be in a vehicle to add a house car");
        return 
1;

PHP код:
CMD:removehouse(playeridparams[])
{
        new 
tmp[256];
        new 
cmd[256+1];
        new 
idx;
        
cmd strtok(cmdtextidx);
        
tmp strtok(cmdtext,idx);
        new 
hid strval(tmp);
        if(
dini_Exists(HouseFile(hid)))
        {
            foreach(
Playeri)
            {
                if(
IsPlayerInHouse[i][hid] == 1)
                {
                    
ExitPlayerFromHouse(i,hid);
                }
            }
            
Delete3DTextLabel(HouseInfo[hid][Text]);
            
DestroyDynamicCP(hCpOut[hid]);
            
IsValidDynamicCP(hCpIn[hid]);
            
dini_Remove(HouseFile(hid));
        }
        return 
1;




Re: COmmands - kloning1 - 14.07.2015

i don't know add char, because i dont know variable player if have house / not

pawn Код:
CMD:removehouse(playerid, params[])
{
    new hid;
    if(sscanf(params, "u", hid)) return SendClientMessage(playerid, -1, "/removehouse [id]");
    if(dini_Exists(HouseFile(hid)))
    {
        foreach(Player, i)
        {
            if(IsPlayerInHouse[i][hid] == 1)
            {
                ExitPlayerFromHouse(i,hid);
            }
        }
        Delete3DTextLabel(HouseInfo[hid][Text]);
        DestroyDynamicCP(hCpOut[hid]);
        IsValidDynamicCP(hCpIn[hid]);
        dini_Remove(HouseFile(hid));
    }
    return 1;
}
+rep please if help you


Re: COmmands - ALoX12 - 14.07.2015

Worked but only remove id 0.

Quote:
Originally Posted by ALoX12
Посмотреть сообщение
also this
PHP код:
CMD:addcar(playerid,params[])
{
        new 
tmp[256];
        new 
cmd[256+1];
        new 
idx;
        
cmd strtok(cmdtextidx);
        
tmp strtok(cmdtext,idx);
        new 
hid strval(tmp);
        if(
IsPlayerInAnyVehicle(playerid))
        {
            new 
Float:X,Float:Y,Float:Z,Float:Angle;
            
GetVehiclePos(GetPlayerVehicleID(playerid), XYZ);
            
GetVehicleZAngle(GetPlayerVehicleID(playerid), Angle);
            new 
model GetVehicleModel(GetPlayerVehicleID(playerid));
            
dini_IntSet(HouseFile(hid),"vModel",model);
            
dini_FloatSet(HouseFile(hid),"vX",X);
            
dini_FloatSet(HouseFile(hid),"vY",Y);
            
dini_FloatSet(HouseFile(hid),"vZ",Z);
            
dini_FloatSet(HouseFile(hid),"vAng",Angle);
        }
        else return 
SendClientMessage(playerid,-1,"You need to be in a vehicle to add a house car");
        return 
1;

PHP код:
CMD:removehouse(playeridparams[])
{
        new 
tmp[256];
        new 
cmd[256+1];
        new 
idx;
        
cmd strtok(cmdtextidx);
        
tmp strtok(cmdtext,idx);
        new 
hid strval(tmp);
        if(
dini_Exists(HouseFile(hid)))
        {
            foreach(
Playeri)
            {
                if(
IsPlayerInHouse[i][hid] == 1)
                {
                    
ExitPlayerFromHouse(i,hid);
                }
            }
            
Delete3DTextLabel(HouseInfo[hid][Text]);
            
DestroyDynamicCP(hCpOut[hid]);
            
IsValidDynamicCP(hCpIn[hid]);
            
dini_Remove(HouseFile(hid));
        }
        return 
1;

anyone else? to convert this into zcmd?


Re: COmmands - ALoX12 - 14.07.2015

ANYONE?