[ZCMD HELP]
#1

Okay so im trying to make a command for VIP's to be able to teleport to players:

pawn Код:
CMD:tp(playerid,params[])
{
        new
        pID,
        Float: X,
        Float: Y,
        Float: Z
    ;
    if(gPlayerData[playerid][E_VIP_LEVEL] < 1) return 0;
    if(sscanf(params, "u" pID)) SendUsage(playerid, "Use tp [PLAYER_ID]");
    else if(pID == playerid) SendError(playerid, "You Cannont Teleport To Your Self");
    else if(!IsPlayerConnected(pID)) SendError(playerid, "Player Is Currently Not Connected");
    else
    {
    GetPlayerPos(pID,X,Y,Z);
    SetPlayerPos(playerid,X,Y + 2, Z);
    }
    return 1;
}
i tho it looked fine untill :

Код:
C:\Users\Admin\Desktop\SAMP\Midnight Drifts\gamemodes\madmin.pwn(287) : warning 217: loose indentation
C:\Users\Admin\Desktop\SAMP\Midnight Drifts\gamemodes\madmin.pwn(288) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\Admin\Desktop\SAMP\Midnight Drifts\gamemodes\madmin.pwn(288) : warning 215: expression has no effect
C:\Users\Admin\Desktop\SAMP\Midnight Drifts\gamemodes\madmin.pwn(288) : error 001: expected token: ";", but found ")"
C:\Users\Admin\Desktop\SAMP\Midnight Drifts\gamemodes\madmin.pwn(288) : error 029: invalid expression, assumed zero
C:\Users\Admin\Desktop\SAMP\Midnight Drifts\gamemodes\madmin.pwn(288) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#2

pawn Код:
CMD:tp(playerid,params[])
{
    new pID,Float:X,Float:Y,Float:Z;
    if(gPlayerData[playerid][E_VIP_LEVEL] < 1) return 0;
    if(sscanf(params, "u", pID)) return SendUsage(playerid, "Use tp [PLAYER_ID]");
    else if(pID == playerid) return SendError(playerid, "You Cannont Teleport To Your Self");
    else if(!IsPlayerConnected(pID)) return SendError(playerid, "Player Is Currently Not Connected");
    else
    {
        GetPlayerPos(pID,X,Y,Z);
        SetPlayerPos(playerid,X,Y + 2, Z);
    }
    return 1;
}
try this, i dont know if it works

EDIT: You forgot a ',' at the sscanf line
Reply
#3

how to modify that cmd for car teleports?
Reply
#4

pawn Код:
CMD:tp(playerid,params[])
{
    new pID,Float:X,Float:Y,Float:Z;
    if(gPlayerData[playerid][E_VIP_LEVEL] < 1) return 0;
    if(sscanf(params, "u", pID)) return SendUsage(playerid, "Use tp [PLAYER_ID]");
    else if(pID == playerid) return SendError(playerid, "You Cannont Teleport To Your Self");
    else if(!IsPlayerConnected(pID)) return SendError(playerid, "Player Is Currently Not Connected");
    else
    {
        if(IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) == 0)
        {
            new vid = GetPlayerVehicleID(playerid);
            SetVehiclePos(vid,X,Y+5,Z);
            SetPlayerPos(playerid,X,Y + 5, Z); //I think this is optional, but I ain't sure...
            PutPlayerInVehicle(playerid,vid,0);
        }
        else
        {
            GetPlayerPos(pID,X,Y,Z);
            SetPlayerPos(playerid,X,Y + 2, Z);
        }
    }
    return 1;
}
Reply
#5

thank you also how would i change the car color ? like which is the new stuff
Reply
#6

You mean after you TP with a car, it changes color?
Then, https://sampwiki.blast.hk/wiki/Function:ChangeVehicleColor
Reply
#7

no /vehcolor [COLOR 1] [COLOR 2]

pawn Код:
CMD:vehcolor(playerid,params[])
{
    new cID;
    new vID = GetPlayerVehicleID(playerid);
    if(gPlayerData[playerid][E_VIP_LEVEL] < 1) return 1;
    else if(sscanf(params, "u", playerid)) SendUsage(playerid, "/vehcolor [COLOR 1] [COLOR 2]");
    else if(IsPlayerInVehicle(playerid,GetPlayerVehicleID(playerid))) SendError(playerid, "You need to be in a vehicle to use this command!");
    else
    {
    ChangeVehicleColor(vID,cID,cID);
    }
    return 1;
}
would that work ?
Reply
#8

No.
pawn Код:
CMD:vehcolor(playerid,params[])
{
    new col1,col2; //The 2 colors.
    if(!IsPlayerInAnyVehicle(playerid)) return SendError(playerid, "You need to be in a vehicle to use this command!"); //If the player isn't in a vehicle, it send the Error.
    new vID = GetPlayerVehicleID(playerid); //The VehicleID
    if(gPlayerData[playerid][E_VIP_LEVEL] < 1) return 1;
    else if(sscanf(params, "ii", col1,col2)) SendUsage(playerid, "/vehcolor [COLOR 1] [COLOR 2]"); //If the parameters he entered aren't Intregers (numbers), it sends the error.
    else if(col1 < 0 && col1 > 126 && col2 < 0 && col2 > 126) return SendError(playerid,"Invalid color!"); //If the color he entered isn't a valid color, it sends the error.
    else
    {
        ChangeVehicleColor(vID,col1,col2);
    }
    return 1;
}
Reply
#9

thanks man rep++
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)