SA-MP Forums Archive
[Quick help] Making an FS work only for selected skin ID's. - 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: [Quick help] Making an FS work only for selected skin ID's. (/showthread.php?tid=299407)



[Quick help] Making an FS work only for selected skin ID's. - Da' J' - 25.11.2011

The title says: How can i make a full FS to work only for specific skin ID's? These would be skin ID's 280-287. Someone's help, thanks.


Re: [Quick help] Making an FS work only for selected skin ID's. - IceCube! - 25.11.2011

Use
pawn Код:
if(GetPlayerSkin(playerid) == Skin id );



Re: [Quick help] Making an FS work only for selected skin ID's. - Da' J' - 25.11.2011

pawn Код:
C:\Users\Da' J'\Desktop\GTA San Andreas modfiles\Raven's Roleplay 0.3c V4.2\filterscripts\SpikeStrip.pwn(29) : error 036: empty statement
C:\Users\Da'
J'\Desktop\GTA San Andreas modfiles\Raven's Roleplay 0.3c V4.2\filterscripts\SpikeStrip.pwn(31) : error 010: invalid function or declaration
C:\Users\Da' J'\Desktop\GTA San Andreas modfiles\Raven's Roleplay 0.3c V4.2\filterscripts\SpikeStrip.pwn(34) : error 021: symbol already defined: "GetPlayerPos"
C:\Users\Da'
J'\Desktop\GTA San Andreas modfiles\Raven's Roleplay 0.3c V4.2\filterscripts\SpikeStrip.pwn(36) : error 021: symbol already defined: "CreateStrip"
C:\Users\Da' J'\Desktop\GTA San Andreas modfiles\Raven's Roleplay 0.3c V4.2\filterscripts\SpikeStrip.pwn(37) : error 010: invalid function or declaration
C:\Users\Da'
J'\Desktop\GTA San Andreas modfiles\Raven's Roleplay 0.3c V4.2\filterscripts\SpikeStrip.pwn(39) : error 010: invalid function or declaration
C:\Users\Da' J'\Desktop\GTA San Andreas modfiles\Raven's Roleplay 0.3c V4.2\filterscripts\SpikeStrip.pwn(41) : error 021: symbol already defined: "DeleteClosestStrip"
C:\Users\Da'
J'\Desktop\GTA San Andreas modfiles\Raven's Roleplay 0.3c V4.2\filterscripts\SpikeStrip.pwn(42) : error 010: invalid function or declaration
C:\Users\Da' J'\Desktop\GTA San Andreas modfiles\Raven's Roleplay 0.3c V4.2\filterscripts\SpikeStrip.pwn(44) : error 010: invalid function or declaration
C:\Users\Da'
J'\Desktop\GTA San Andreas modfiles\Raven's Roleplay 0.3c V4.2\filterscripts\SpikeStrip.pwn(46) : error 021: symbol already defined: "DeleteAllStrip"
C:\Users\Da' J'\Desktop\GTA San Andreas modfiles\Raven's Roleplay 0.3c V4.2\filterscripts\SpikeStrip.pwn(47) : error 010: invalid function or declaration
C:\Users\Da'
J'\Desktop\GTA San Andreas modfiles\Raven's Roleplay 0.3c V4.2\filterscripts\SpikeStrip.pwn(50) : error 010: invalid function or declaration
C:\Users\Da' J'\Desktop\GTA San Andreas modfiles\Raven's Roleplay 0.3c V4.2\filterscripts\SpikeStrip.pwn(52) : warning 203: symbol is never used: "ploca"
C:\Users\Da'
J'\Desktop\GTA San Andreas modfiles\Raven's Roleplay 0.3c V4.2\filterscripts\SpikeStrip.pwn(52) : warning 203: symbol is never used: "plocx"
C:\Users\Da' J'\Desktop\GTA San Andreas modfiles\Raven's Roleplay 0.3c V4.2\filterscripts\SpikeStrip.pwn(52) : warning 203: symbol is never used: "plocy"
C:\Users\Da'
J'\Desktop\GTA San Andreas modfiles\Raven's Roleplay 0.3c V4.2\filterscripts\SpikeStrip.pwn(52) : warning 203: symbol is never used: "plocz"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


12 Errors.
This is what i get... So how i should do it -.- This is the script where i want it:

pawn Код:
#include <a_samp>
#include <SpikeStrip>

strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256];
    new idx;
    cmd = strtok(cmdtext, idx);
   
    if(GetPlayerSkin(playerid) == 280);
    }
    if (strcmp(cmd,"/createstrip",true) == 0)
    {
        new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
        GetPlayerPos(playerid, plocx, plocy, plocz);
        GetPlayerFacingAngle(playerid,ploca);
        CreateStrip(plocx,plocy,plocz,ploca);
        return 1;
    }
    else if (strcmp(cmd,"/removestrip",true) == 0)
    {
        DeleteClosestStrip(playerid);
        return 1;
    }
    else if (strcmp(cmd,"/removeallstrip",true) == 0)
    {
        DeleteAllStrip();
        return 1;
    }
   
    return 0;
}



Re: [Quick help] Making an FS work only for selected skin ID's. - Kostas' - 25.11.2011

Do you want only if someone has skin 280 to use the commands?
However, you closed the bracket instead of open it and close it at the end.
I don't know if this is you are looking for.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256];
    new idx;
    cmd = strtok(cmdtext, idx);
    if(GetPlayerSkin(playerid) == 280);
    {
        if (strcmp(cmd,"/createstrip",true) == 0) {
            new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
            GetPlayerPos(playerid, plocx, plocy, plocz);
            GetPlayerFacingAngle(playerid,ploca);
            CreateStrip(plocx,plocy,plocz,ploca);
            return 1;
        }
        else if (strcmp(cmd,"/removestrip",true) == 0) {
            DeleteClosestStrip(playerid);
            return 1;
        }
        else if (strcmp(cmd,"/removeallstrip",true) == 0) {
            DeleteAllStrip();
            return 1;
        }
    }
    return 0;
}



Re: [Quick help] Making an FS work only for selected skin ID's. - Da' J' - 25.11.2011

Still no help... O.o It says this at the GetPlayerSkin:
pawn Код:
C:\Users\Da' J'\Desktop\GTA San Andreas modfiles\Raven's Roleplay 0.3c V4.2\filterscripts\SpikeStrip.pwn(28) : error 036: empty statement
Pawn compiler 3.2.3664          Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: [Quick help] Making an FS work only for selected skin ID's. - Kostas' - 25.11.2011

Replace
pawn Код:
if(GetPlayerSkin(playerid) == 280); // It shoudn't be with ";"
With
pawn Код:
if(GetPlayerSkin(playerid) == 280)
========
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256];
    new idx;
    cmd = strtok(cmdtext, idx);
    if(GetPlayerSkin(playerid) == 280)
    {
        if (strcmp(cmd,"/createstrip",true) == 0) {
            new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
            GetPlayerPos(playerid, plocx, plocy, plocz);
            GetPlayerFacingAngle(playerid,ploca);
            CreateStrip(plocx,plocy,plocz,ploca);
            return 1;
        }
        else if (strcmp(cmd,"/removestrip",true) == 0) {
            DeleteClosestStrip(playerid);
            return 1;
        }
        else if (strcmp(cmd,"/removeallstrip",true) == 0) {
            DeleteAllStrip();
            return 1;
        }
    }
    return 0;
}



Re: [Quick help] Making an FS work only for selected skin ID's. - Da' J' - 25.11.2011

Now works! And if you could, can you tell me how i can put there all the other skin ID's with the 280? Like, all between 280 and 286.


Re: [Quick help] Making an FS work only for selected skin ID's. - Rob_Maate - 25.11.2011

pawn Код:
if(GetPlayerSkin(playerid) == 280 ||
GetPlayerSkin(playerid) == 281 ||
GetPlayerSkin(playerid) == 282 ||
GetPlayerSkin(playerid) == 283 ||
GetPlayerSkin(playerid) == 284 ||
GetPlayerSkin(playerid) == 285 ||
GetPlayerSkin(playerid) == 286)
{
//code here
}
There's probably shorter ways to write that, but idc im tired


Re: [Quick help] Making an FS work only for selected skin ID's. - Kostas' - 25.11.2011

Try this
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256];
    new idx;
    cmd = strtok(cmdtext, idx);
    if(GetPlayerSkin(playerid) == 280 || if(GetPlayerSkin(playerid) == 281 || GetPlayerSkin(playerid) == 282 || GetPlayerSkin(playerid) == 283 || GetPlayerSkin(playerid) == 284 || GetPlayerSkin(playerid) == 285 || GetPlayerSkin(playerid) == 286)
    {
        if (strcmp(cmd,"/createstrip",true) == 0) {
            new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
            GetPlayerPos(playerid, plocx, plocy, plocz);
            GetPlayerFacingAngle(playerid,ploca);
            CreateStrip(plocx,plocy,plocz,ploca);
            return 1;
        }
        else if (strcmp(cmd,"/removestrip",true) == 0) {
            DeleteClosestStrip(playerid);
            return 1;
        }
        else if (strcmp(cmd,"/removeallstrip",true) == 0) {
            DeleteAllStrip();
            return 1;
        }
    }
    return 0;
}
Edit: User above was faster!


Re: [Quick help] Making an FS work only for selected skin ID's. - Rob_Maate - 25.11.2011

Quote:
Originally Posted by Kostas'
Посмотреть сообщение
Try this
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256];
    new idx;
    cmd = strtok(cmdtext, idx);
    if(GetPlayerSkin(playerid) == 280 || GetPlayerSkin(playerid) == 281 || GetPlayerSkin(playerid) == 282 || GetPlayerSkin(playerid) == 283 || GetPlayerSkin(playerid) == 284 || GetPlayerSkin(playerid) == 285 || GetPlayerSkin(playerid) == 286)
    {
        if (strcmp(cmd,"/createstrip",true) == 0) {
            new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
            GetPlayerPos(playerid, plocx, plocy, plocz);
            GetPlayerFacingAngle(playerid,ploca);
            CreateStrip(plocx,plocy,plocz,ploca);
            return 1;
        }
        else if (strcmp(cmd,"/removestrip",true) == 0) {
            DeleteClosestStrip(playerid);
            return 1;
        }
        else if (strcmp(cmd,"/removeallstrip",true) == 0) {
            DeleteAllStrip();
            return 1;
        }
    }
    return 0;
}
Edit: User above was faster!
You had an if( halfway through your if statement lmao