SetPlayerAttachedObject error -
SiNaGaMeR - 26.02.2018
hi guys, i have some problems with mapping such as SetPlayerAttachedObject ...
recently i make new command but my command has some error but my game mode hasn't any error..
SetPlayerAttachedObject is my problem when my command used just attachedobjects show for 0.5 seconds and fast removed what is my error?
Please Watch Video for tell me what is wrong?
My Problem Video! Click Here to Watch My Problem Video.
my codes that i used:
Код:
if(!strcmp(cmd,"/mybird",true))
{
if(PINFO[playerid][pPremiumAccount] < 1) return SendMessage(playerid, COLOR_YELLOW2, "Error: you are not premium.");
SetPlayerAttachedObject( playerid, 1, 19079, 1, 0.300000, -0.0800000, -0.140000, 0000.000000, 0.00000, 0.0000000, 1.000000, 1.000000, 1.000000 );
SendMessage(playerid, COLOR_SINAGAMER, "You called your bird. you can use /removebird to remove it.");
return 1;
}
Код:
if(strcmp("/removebird", cmdtext, true) == 0)
{
if(PINFO[playerid][pPremiumAccount] < 1) return SendMessage(playerid, COLOR_YELLOW2, "Error: you are not premium.");
RemovePlayerAttachedObject(playerid, 1);
SendMessage(playerid, COLOR_SINAGAMER, "You removed your bird.");
return 1;
}
Код:
if(!strcmp(cmd, "/skate", true)) {
if(PlayerInfo[playerid][pPremiumAccount] == 0) return SCM(playerid, COLOR_SINAGAMER, "Error: you haven't premium account.");
ShowPlayerDialog(playerid,9968,DIALOG_STYLE_LIST,"Skate Panel","Get Board\nRemove Board","Select","Cancel");
return 1;
}
Код:
if(dialogid == 9968) {
if(response) {
ApplyAnimation(playerid, "CARRY","null",0,0,0,0,0,0,0);
ApplyAnimation(playerid, "SKATE","null",0,0,0,0,0,0,0);
ApplyAnimation(playerid, "CARRY","crry_prtial",4.0,0,0,0,0,0);
SetPlayerArmedWeapon(playerid,0);
if(listitem == 0) {
if(!InfoSkate[playerid][sActive]){
if(IsPlayerInAnyVehicle(playerid)) return SCM(playerid, COLOR_SINAGAMER, "You are in a vehicle.");
InfoSkate[playerid][sActive] = true;
DestroyObject(InfoSkate[playerid][sSkate]);
RemovePlayerAttachedObject(playerid,INDEX_SKATE);
#if TYPE_SKATE == 0
// the skate is placed on the right arm
SetPlayerAttachedObject(playerid,INDEX_SKATE,19878,6,-0.055999,0.013000,0.000000,-84.099983,0.000000,-106.099998,1.000000,1.000000,1.000000);
#else
// the skate is placed in the back
SetPlayerAttachedObject(playerid,INDEX_SKATE,19878,1,0.055999,-0.173999,-0.007000,-95.999893,-1.600010,24.099992,1.000000,1.000000,1.000000);
#endif
PlayerPlaySound(playerid,21000,0,0,0);
SendClientMessage(playerid,COLOR_YELLOW,"Skateboard added to you.");
SendClientMessage(playerid,COLOR_YELLOW,"Click on right mouse button (RMB) to run.");
}
else return SCM(playerid, COLOR_SINAGAMER, "You already have a skateboard.");
}
else {
InfoSkate[playerid][sActive] = false;
DestroyObject(InfoSkate[playerid][sSkate]);
RemovePlayerAttachedObject(playerid,INDEX_SKATE);
PlayerPlaySound(playerid,21000,0,0,0);
SendClientMessage(playerid,COLOR_YELLOW,"Skateboard removed from you.");
}
}
else {}
return 1;
}
Код:
new InfoSkate[MAX_PLAYERS][skate];
InfoSkate[playerid][sActive] = false;
Код:
if(InfoSkate[playerid][sActive] && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT){
static bool:act;
SetPlayerArmedWeapon(playerid,0);
if(newkeys & KEY_HANDBRAKE){
#if MODE_SKATE == 0
// medium speed
ApplyAnimation(playerid, "SKATE","skate_run",4.1,1,1,1,1,1,1);
#else
// fast speed
ApplyAnimation(playerid, "SKATE","skate_sprint",4.1,1,1,1,1,1,1);
#endif
if(!act){
act = true;
RemovePlayerAttachedObject(playerid,INDEX_SKATE);
DestroyObject(InfoSkate[playerid][sSkate]);
InfoSkate[playerid][sSkate] = CreateObject(19878,0,0,0,0,0,0);
AttachObjectToPlayer(InfoSkate[playerid][sSkate],playerid, -0.2,0,-0.9,0,0,90);
}
}
if(oldkeys & KEY_HANDBRAKE){
ApplyAnimation(playerid, "CARRY","crry_prtial",4.0,0,0,0,0,0);
if(act){
act = false;
DestroyObject(InfoSkate[playerid][sSkate]);
RemovePlayerAttachedObject(playerid,INDEX_SKATE);
#if TYPE_SKATE == 0
// the skate is placed on the right arm
SetPlayerAttachedObject(playerid,INDEX_SKATE,19878,6,-0.055999,0.013000,0.000000,-84.099983,0.000000,-106.099998,1.000000,1.000000,1.000000);
#else
// the skate is placed in the back
SetPlayerAttachedObject(playerid,INDEX_SKATE,19878,1,0.055999,-0.173999,-0.007000,-95.999893,-1.600010,24.099992,1.000000,1.000000,1.000000);
#endif
}
}
}
Re: SetPlayerAttachedObject error -
PepsiCola23 - 26.02.2018
i think you are attaching the object to the wrong bone.
https://sampwiki.blast.hk/wiki/Bone_IDs
Re: SetPlayerAttachedObject error -
SiNaGaMeR - 26.02.2018
@PepsiCola23
no it's right but i ask to more scripters they answer me your objects is very much and for it but i disabled all my recently added createobjects but it's not working and it's wrong...
Guys please answer me!
Re: SetPlayerAttachedObject error -
EatLag - 02.03.2018
Have you read the above comment?
Re: SetPlayerAttachedObject error -
SiNaGaMeR - 04.03.2018
yes ;\