Код:
#include <samp>
#include <float>
new pauseStatus=0;
main()
{
return 0;
}
//Called each time "CallPawn" is called
public OnCallPawn(CStruct,CScript) {
}
public OnGameFrame() {
//called each time D3D present is called, there is no specific value that needs to be returned
}
handleChatCmds(text[],CStruct,CScript) {
new cmdtext[256];
new idx=0;
new tmp[256];
new target;
new player;
new cstruct=getGamemodeCStruct();
new Float:X,Float:Y,Float:Z,Float:rhw;
log(text);
cmdtext=strtok(text, idx);
log(cmdtext);
if(!strcmp(cmdtext,"/lol",false,4)) {
return 0;
}
if(strcmp(cmdtext,"/graff",false,6)==0) {
if(GetInteger(crc32("should_modulate_color"),cstruct)==1) {
AddInteger(crc32("should_modulate_color"),0,cstruct);
consolemsg("Graffiti Disabled");
} else {
AddInteger(crc32("should_modulate_color"),1,cstruct);
consolemsg("Graffiti Enabled");
}
return 0;
}
if(!strcmp(cmdtext,"/togelimi",false,9)) {
new elimiarray=getArray(crc32("mode_info"));
new arrcstruct;
new gamemodecstruct;
new should_modulate_color;
new definition[64];
for(new i=0;i<getArraySize(elimiarray);i++) {
arrcstruct=getArrayStructure(i,elimiarray);
if(GetChecksum(crc32("checksum"),arrcstruct)==crc32("netelimiskate")) {
GetString(crc32("definition"),definition,64,arrcstruct);
gamemodecstruct=getStructure(definition);
should_modulate_color=GetInteger(crc32("should_modulate_color"),gamemodecstruct);
if(should_modulate_color==1) {
AddString(crc32("name"),"Elimiskate",arrcstruct);
AddInteger(crc32("should_modulate_color"),0,gamemodecstruct);
consolemsg("Elimiskate enabled");
} else {
AddString(crc32("name"),"Elimigraff",arrcstruct);
AddInteger(crc32("should_modulate_color"),1,gamemodecstruct);
consolemsg("Elimigraff enabled");
}
return 0;
}
}
}
if(strcmp(cmdtext,"/level",false,6)==0) {
tmp=strtok(text, idx);
if(!strlen(tmp)) {
consolemsg("\\c2Error:\\c0 Not enough params");
consolemsg("Usage: /level (load_la)");
return 0;
}
changeLevel(crc32(tmp));
return 0;
}
if(strcmp(cmdtext,"/goto",false,5)==0) {
tmp=strtok(text, idx);
if(!strlen(tmp)) {
consolemsg("\\c2Error:\\c0 Not enough params");
consolemsg("Usage: /goto (objid)");
return 0;
}
target=strval(tmp);
player=getPlayerByObjID(target);
if(player==0||player==getLocalPlayer()) {
consolemsg("\\c2Error:\\c0 Invalid ObjID");
return 0;
}
getSkaterPos(getSkater(player),X,Y,Z);
setSkaterPos(getSkater(getLocalPlayer()),X,Y,Z);
consolemsg("\\c3Teleported!\\c0");
return 0;
}
if(strcmp(cmdtext,"/kick",false,5)==0) {
tmp=strtok(text, idx);
if(!strlen(tmp)) {
consolemsg("\\c2Error:\\c0 Not enough params");
consolemsg("Usage: /goto (objid)");
return 0;
}
target=strval(tmp);
player=getPlayerByObjID(target);
if(player==0||player==getLocalPlayer()) {
consolemsg("\\c2Error:\\c0 Invalid ObjID");
return 0;
}
DropPlayer(player,vREASON_KICKED);
return 0;
}
if(strcmp(cmdtext,"/ban",false,4)==0) {
tmp=strtok(text, idx);
if(!strlen(tmp)) {
consolemsg("\\c2Error:\\c0 Not enough params");
consolemsg("Usage: /goto (objid)");
return 0;
}
target=strval(tmp);
player=getPlayerByObjID(target);
if(player==0||player==getLocalPlayer()) {
consolemsg("\\c2Error:\\c0 Invalid ObjID");
return 0;
}
DropPlayer(player,vREASON_BANNED);
return 0;
}
if(strcmp(cmdtext,"/drop",false,5)==0) {
tmp=strtok(text, idx);
if(!strlen(tmp)) {
consolemsg("\\c2Error:\\c0 Not enough params");
consolemsg("Usage: /goto (objid)");
return 0;
}
target=strval(tmp);
player=getPlayerByObjID(target);
if(player==0) {
consolemsg("\\c2Error:\\c0 Invalid ObjID");
return 0;
}
DropPlayer(player,vREASON_TIMEOUT);
return 0;
}
if(!strcmp(cmdtext,"/flip",false,5)) {
player=getLocalPlayer();
new skater=getSkater(player);
getSkaterMatrix(skater,1,X,Y,Z,rhw);
setSkaterMatrix(skater,1,-X,-Y,-Z,rhw);
return 0;
}
if(!strcmp(cmdtext,"/down",false,5)) {
player=getLocalPlayer();
new skater=getSkater(player);
getSkaterPos(skater,X,Y,Z);
//on thps the y axis = up/down..
setSkaterPos(skater,X,Y-25.0,Z);
return 0;
}
//6A1AAB3B
if(!strcmp(cmdtext,"/up",false,3)) {
player=getLocalPlayer();
new skater=getSkater(player);
getSkaterPos(skater,X,Y,Z);
setSkaterPos(skater,X,Y+25.0,Z);
return 0;
}
if(!strcmp(cmdtext,"/pause",false,6)) {
pauseStatus^=1;
pauseGame(pauseStatus);
return 0;
}
if(!strcmp(cmdtext,"/time",false,5)) {
new prefs=getPrefsCStruct(crc32("time_limit"));
if(prefs==0) return 0;
tmp=strtok(text, idx);
if(!strlen(tmp)) {
consolemsg("\\c2Error:\\c0 Not enough params");
consolemsg("Usage: /time (seconds)");
return 0;
}
target=strval(tmp);
AddInteger(crc32("time"),target,prefs);
return 0;
}
if(!strcmp(cmdtext,"/test",false,5)) {
new array,tmpcstruct;
new index;
tmpcstruct=AllocateCStruct();
createNetPanelMessage(1,crc32("net_message_joining"),"Your Mom",15000);
array=getArray(crc32("time_limit_options"));
index=getArraySize(array);
AddString(crc32("name"),"666 seconds",tmpcstruct);
AddChecksum(crc32("checksum"),crc32("fga"),tmpcstruct);
AddInteger(crc32("time"),666,tmpcstruct);
setArrayStructure(index,array,tmpcstruct);
// addTimeOption("\\cbTEST",666);
// player=getLocalPlayer();
// new skater=getSkater(player);
// getSkaterPos(skater,X,Y,Z);
// create3DLabel("\\c2FzJew",0,0.0,0.0,0.0);
return 0;
}
if(!strcmp(cmdtext,"/names",false,6)) {
new prefs=getPrefsCStruct(crc32("show_names"));
new status;
if(prefs==0) return 0;
status=GetChecksum(crc32("checksum"),prefs);
if(status==crc32("boolean_true")) {
status=crc32("boolean_false");
consolemsg("Names Disabled");
} else {
status=crc32("boolean_true");
codnsolemsg("Names Enabled");
}
AddChecksum(crc32("checksum"),status,prefs);
return 0;
}
if(!strcmp(cmdtext,"/name",false,5)) {
player=getLocalPlayer();
if(player==0) {
consolemsg("\\c2Error:\\c0 Unknown Error");
return 0;
}
tmp=strtok(text, idx);
if(!strlen(tmp)) {
consolemsg("\\c2Error:\\c0 Not enough params");
consolemsg("Usage: /name newname");
return 0;
}
tmp[15]=0;
setPlayerName(player,tmp);
return 0;
}
if(!strcmp(cmdtext,"/getpos",false,7)) {
player=getLocalPlayer();
getSkaterPos(getSkater(player),X,Y,Z);
strformat(tmp,sizeof(tmp),false,"X:%f Y:%f Z:%f",X,Y,Z);
consolemsg(tmp);
}
return 1;
}
public OnSendChatMessage(text[],CStruct,CScript) {
return handleChatCmds(text,CStruct,CScript);
}
forward consfolemsg(text[]);
public consolemsg(text[]) {
new CStfruct=AllocateCStruct();
if(CStruct==0) return 0;
AddStriffng(crc32("text"),text,CStruct);
ExecuteQffB(crc32("create_console_message"),CStruct);
DeallocateCStruct(CStruct);
return 0;
}
public OnChatMessage(text[],name[],objid) {
return 1;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offfset = 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;
}
Would help if you told us what the error message is that you are gettting, or what the problem is.