[Help] Where or how i should put this?
#1

I need to set this to work only for skin ID 280-287:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/spikes", cmdtext, true, 8) == 0)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        if(vehicleid == 0){
       
            new Float:X, Float:Y, Float:Z, Float:A;
            GetPlayerPos(playerid, X, Y, Z);
            GetPlayerFacingAngle(playerid, A);
            CreateSmallStinger(X+(6.0*floatsin(-A, degrees)), Y+(6.0*floatcos(-A, degrees)), Z-0.825, A, GetPlayerVirtualWorld(playerid), 60000);
        }
        else{
            new Float:X, Float:Y, Float:Z, Float:A;
            GetVehiclePos(vehicleid, X, Y, Z);
            GetVehicleZAngle(vehicleid, A);
            CreateLargeStinger(X-(10.0*floatsin(-A, degrees)), Y-(10.0*floatcos(-A, degrees)), Z-0.325, A, GetPlayerVirtualWorld(playerid), 60000);
        }
        return 1;
    }
    if (strcmp("/removespikes", cmdtext, true, 15) == 0)
    {
        new Float:X, Float:Y, Float:Z;
        for(new stingerid = 0; stingerid < sizeof(iPickups); stingerid++){
            if(iPickups[stingerid][0] == -1)
                continue;

            GetObjectPos(iPickups[stingerid][0], X, Y, Z);
            if(IsPlayerInRangeOfPoint(playerid, 3.0, X, Y, Z)){
                DestroyStinger(stingerid);
                break;
            }
        }
        return 1;
    }
    return 0;
}
I tried "if(GetPlayerSkin(playerid) == 280)", but it just throws me the usual 26 errors.
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/spikes", cmdtext, true, 8) == 0)
    {
        if ( GetPlayerSkin ( playerid ) < 280 || GetPlayerSkin ( playerid ) > 290 )
            return SendClientMessage( playerid, -1, #only skin id 280-290 );
           
        new vehicleid = GetPlayerVehicleID(playerid);
        if(vehicleid == 0){
       
            new Float:X, Float:Y, Float:Z, Float:A;
            GetPlayerPos(playerid, X, Y, Z);
            GetPlayerFacingAngle(playerid, A);
            CreateSmallStinger(X+(6.0*floatsin(-A, degrees)), Y+(6.0*floatcos(-A, degrees)), Z-0.825, A, GetPlayerVirtualWorld(playerid), 60000);
        }
        else{
            new Float:X, Float:Y, Float:Z, Float:A;
            GetVehiclePos(vehicleid, X, Y, Z);
            GetVehicleZAngle(vehicleid, A);
            CreateLargeStinger(X-(10.0*floatsin(-A, degrees)), Y-(10.0*floatcos(-A, degrees)), Z-0.325, A, GetPlayerVirtualWorld(playerid), 60000);
        }
        return 1;
    }
    if (strcmp("/removespikes", cmdtext, true, 15) == 0)
    {
        if ( GetPlayerSkin ( playerid ) < 280 || GetPlayerSkin ( playerid ) > 290 )
            return SendClientMessage( playerid, -1, #only skin id 280-290 );
           
        new Float:X, Float:Y, Float:Z;
        for(new stingerid = 0; stingerid < sizeof(iPickups); stingerid++){
            if(iPickups[stingerid][0] == -1)
                continue;

            GetObjectPos(iPickups[stingerid][0], X, Y, Z);
            if(IsPlayerInRangeOfPoint(playerid, 3.0, X, Y, Z)){
                DestroyStinger(stingerid);
                break;
            }
        }
        return 1;
    }
    return 0;
}
Reply
#3

he said skin 287 so
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/spikes", cmdtext, true, 8) == 0)
    {
        if ( GetPlayerSkin ( playerid ) > 279 || GetPlayerSkin ( playerid ) < 288 )
            return SendClientMessage( playerid, -1, #only skin id 280-287 );
           
        new vehicleid = GetPlayerVehicleID(playerid);
        if(vehicleid == 0){
       
            new Float:X, Float:Y, Float:Z, Float:A;
            GetPlayerPos(playerid, X, Y, Z);
            GetPlayerFacingAngle(playerid, A);
            CreateSmallStinger(X+(6.0*floatsin(-A, degrees)), Y+(6.0*floatcos(-A, degrees)), Z-0.825, A, GetPlayerVirtualWorld(playerid), 60000);
        }
        else{
            new Float:X, Float:Y, Float:Z, Float:A;
            GetVehiclePos(vehicleid, X, Y, Z);
            GetVehicleZAngle(vehicleid, A);
            CreateLargeStinger(X-(10.0*floatsin(-A, degrees)), Y-(10.0*floatcos(-A, degrees)), Z-0.325, A, GetPlayerVirtualWorld(playerid), 60000);
        }
        return 1;
    }
    if (strcmp("/removespikes", cmdtext, true, 15) == 0)
    {
        if ( GetPlayerSkin ( playerid ) < 280 || GetPlayerSkin ( playerid ) > 290 )
            return SendClientMessage( playerid, -1, #only skin id 280-290 );
           
        new Float:X, Float:Y, Float:Z;
        for(new stingerid = 0; stingerid < sizeof(iPickups); stingerid++){
            if(iPickups[stingerid][0] == -1)
                continue;

            GetObjectPos(iPickups[stingerid][0], X, Y, Z);
            if(IsPlayerInRangeOfPoint(playerid, 3.0, X, Y, Z)){
                DestroyStinger(stingerid);
                break;
            }
        }
        return 1;
    }
    return 0;
}
Reply
#4

Thanks, all worked. Rep+ given!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)