PDA

View Full Version : [Quick help] Making an FS work only for selected skin ID's.


Da' J'
25/11/2011, 08:11 PM
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.

IceCube!
25/11/2011, 08:17 PM
Use
if(GetPlayerSkin(playerid) == Skin id );

Da' J'
25/11/2011, 08:27 PM
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:

#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;
}

Kostas'
25/11/2011, 09:09 PM
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.

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;
}

Da' J'
25/11/2011, 09:36 PM
Still no help... O.o It says this at the GetPlayerSkin: 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 (c) 1997-2006, ITB CompuPhase


1 Error.

Kostas'
25/11/2011, 09:45 PM
Replace

if(GetPlayerSkin(playerid) == 280); // It shoudn't be with ";"

With

if(GetPlayerSkin(playerid) == 280)

========

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;
}

Da' J'
25/11/2011, 09:50 PM
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.

Rob_Maate
25/11/2011, 09:54 PM
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

Kostas'
25/11/2011, 09:55 PM
Try this
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!

Rob_Maate
25/11/2011, 09:56 PM
Try this
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

Kostas'
25/11/2011, 09:59 PM
Fixed! Thanks, I paste it fast and forgot to remove it.
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;
}